From: Krinkle Date: Thu, 7 Jul 2011 17:52:55 +0000 (+0000) Subject: Removing calls to deprecated functionality in favor of the new versions. Old version... X-Git-Tag: 1.31.0-rc.0~29007 X-Git-Url: http://git.cyclocoop.org/%40spipnet%40?a=commitdiff_plain;h=29976f1c9185ebde595a41efedbf4820ab4a1373;p=lhc%2Fweb%2Fwiklou.git Removing calls to deprecated functionality in favor of the new versions. Old version worked fine but shouldn't be used. Follows-up: * r75275: Introduced the updateTooltipAccessKeys function in the new library but didn't call it on document ready and left the deprecated one in the onloadhook-run in wikibits.js untouched * r75287: Introduced jquery.checkboxShiftClick and called on-load but left the load call for the legacy version untouched. Depending on the load order at any given time it may not have been used. Also reordering the if-else case in mw.util.updateTooltipAccessKeys to allow a call without arguments ("undefined instanceof Foo" throws exception) --- diff --git a/resources/mediawiki.page/mediawiki.page.ready.js b/resources/mediawiki.page/mediawiki.page.ready.js index c9f4ad4077..eba5db1159 100644 --- a/resources/mediawiki.page/mediawiki.page.ready.js +++ b/resources/mediawiki.page/mediawiki.page.ready.js @@ -18,4 +18,7 @@ jQuery( document ).ready( function( $ ) { /* Enable CheckboxShiftClick */ $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick(); + /* Add accesskey hints to the tooltips */ + mw.util.updateTooltipAccessKeys(); + } ); diff --git a/resources/mediawiki/mediawiki.util.js b/resources/mediawiki/mediawiki.util.js index 435a105c49..ebd63ef275 100644 --- a/resources/mediawiki/mediawiki.util.js +++ b/resources/mediawiki/mediawiki.util.js @@ -250,15 +250,12 @@ * otherwise, all the nodes that will probably have accesskeys by * default are updated. * - * @param nodeList mixed A jQuery object, or array of elements to update. + * @param nodeList {Array|jQuery} (optional) A jQuery object, or array of elements to update. */ 'updateTooltipAccessKeys' : function( nodeList ) { var $nodes; - if ( nodeList instanceof jQuery ) { - $nodes = nodeList; - } else if ( nodeList ) { - $nodes = $( nodeList ); - } else { + if ( !nodeList ) { + // Rather than scanning all links, just the elements that // contain the relevant links this.updateTooltipAccessKeys( @@ -267,7 +264,13 @@ // these are rare enough that no such optimization is needed this.updateTooltipAccessKeys( $( 'input' ) ); this.updateTooltipAccessKeys( $( 'label' ) ); + return; + + } else if ( nodeList instanceof jQuery ) { + $nodes = nodeList; + } else { + $nodes = $( nodeList ); } $nodes.each( function ( i ) { diff --git a/skins/common/wikibits.js b/skins/common/wikibits.js index 81cad57753..5cb037be24 100644 --- a/skins/common/wikibits.js +++ b/skins/common/wikibits.js @@ -612,9 +612,6 @@ window.runOnloadHook = function() { // might cause the function to terminate prematurely doneOnloadHook = true; - updateTooltipAccessKeys( null ); - setupCheckboxShiftClick(); - // Run any added-on functions for ( var i = 0; i < onloadFuncts.length; i++ ) { onloadFuncts[i]();