r75793 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r75792‎ | r75793 | r75794 >
Date:15:06, 1 November 2010
Author:catrope
Status:ok
Tags:
Comment:
(bug 25726) Use .delegate() for collapsible nav so dynamically added sections are automatically picked up on
Modified paths:
  • /trunk/extensions/Vector/modules/ext.vector.collapsibleNav.js (modified) (history)

Diff [purge]

Index: trunk/extensions/Vector/modules/ext.vector.collapsibleNav.js
@@ -211,14 +211,14 @@
212212 $(this).attr( 'tabindex', tabIndex++ );
213213 } );
214214 // Toggle the selected menu's class and expand or collapse the menu
215 - $headings
216 - // Make the space and enter keys act as a click
217 - .keydown( function( event ) {
 215+ $( '#mw-panel' )
 216+ .delegate( 'div.portal:not(.persistent) > h5', 'keydown', function( event ) {
 217+ // Make the space and enter keys act as a click
218218 if ( event.which == 13 /* Enter */ || event.which == 32 /* Space */ ) {
219219 toggle( $(this) );
220220 }
221221 } )
222 - .mousedown( function() {
 222+ .delegate( 'div.portal:not(.persistent) > h5', 'mousedown', function() {
223223 toggle( $(this) );
224224 $(this).blur();
225225 return false;

Status & tagging log