r86958 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86957‎ | r86958 | r86959 >
Date:18:01, 26 April 2011
Author:krinkle
Status:ok
Tags:
Comment:
Selectors go from right to left. Starting with a generic 'a' is kind of slow. Also loses the advantage of an id-selector.
* Optimizing by selecting the ID seperately (very fast) and doing a find() within that context (also caching pCactions ).
* while at it:
- caching selector
- aliasing $ to jQuery locally
- Shorthand dom-ready

(Follow-up r86861)
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/skins/vector/vector.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/vector/vector.js
@@ -1,18 +1,19 @@
22 /*
33 * Vector-specific scripts
44 */
5 -$(document).ready( function() {
 5+jQuery( function( $ ) {
 6+ var $pCactions = $( '#p-cactions' );
67 // For accessibility, show the menu when the hidden link in the menu is clicked
7 - $( '#p-cactions h5 a' ).click( function() {
8 - $( '#p-cactions .menu' ).toggleClass( 'menuForceShow' );
 8+ $pCactions.find( 'h5 a' ).click( function() {
 9+ $pCactions.find( '.menu' ).toggleClass( 'menuForceShow' );
910 });
10 -
 11+
1112 // When the hidden link has focus, also set a class that will change the arrow icon
12 - $( '#p-cactions h5 a' ).focus( function () {
13 - $( '#p-cactions' ).addClass( 'vectorMenuFocus' );
 13+ $pCactions.find( 'h5 a' ).focus( function () {
 14+ $pCactions.addClass( 'vectorMenuFocus' );
1415 });
15 -
16 - $( '#p-cactions h5 a' ).blur( function () {
17 - $( '#p-cactions' ).removeClass( 'vectorMenuFocus' );
 16+
 17+ $pCactions.find( 'h5 a' ).blur( function () {
 18+ $pCactions.removeClass( 'vectorMenuFocus' );
1819 });
1920 });
Index: trunk/phase3/CREDITS
@@ -65,6 +65,7 @@
6666 * Soxred93
6767 * Thomas Bleher
6868 * Tim Starling
 69+* Timo Tijhof
6970 * Tom Gries
7071 * Trevor Parscal
7172 * Victor Vasiliev

Follow-up revisions

RevisionCommit summaryAuthorDate
r86963* Fix ancient jumpy bug when clicking the hover-triangle (normally nobody doe...krinkle18:18, 26 April 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r86861(bug 24298) Make dropdown menus in Vector more accessible by expanding and co...catrope14:08, 25 April 2011

Status & tagging log