r91660 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91659‎ | r91660 | r91661 >
Date:17:52, 7 July 2011
Author:krinkle
Status:ok
Tags:
Comment:
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)
Modified paths:
  • /trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js (modified) (history)
  • /trunk/phase3/resources/mediawiki/mediawiki.util.js (modified) (history)
  • /trunk/phase3/skins/common/wikibits.js (modified) (history)

Diff [purge]

Index: trunk/phase3/skins/common/wikibits.js
@@ -612,9 +612,6 @@
613613 // might cause the function to terminate prematurely
614614 doneOnloadHook = true;
615615
616 - updateTooltipAccessKeys( null );
617 - setupCheckboxShiftClick();
618 -
619616 // Run any added-on functions
620617 for ( var i = 0; i < onloadFuncts.length; i++ ) {
621618 onloadFuncts[i]();
Index: trunk/phase3/resources/mediawiki/mediawiki.util.js
@@ -250,15 +250,12 @@
251251 * otherwise, all the nodes that will probably have accesskeys by
252252 * default are updated.
253253 *
254 - * @param nodeList mixed A jQuery object, or array of elements to update.
 254+ * @param nodeList {Array|jQuery} (optional) A jQuery object, or array of elements to update.
255255 */
256256 'updateTooltipAccessKeys' : function( nodeList ) {
257257 var $nodes;
258 - if ( nodeList instanceof jQuery ) {
259 - $nodes = nodeList;
260 - } else if ( nodeList ) {
261 - $nodes = $( nodeList );
262 - } else {
 258+ if ( !nodeList ) {
 259+
263260 // Rather than scanning all links, just the elements that
264261 // contain the relevant links
265262 this.updateTooltipAccessKeys(
@@ -267,7 +264,13 @@
268265 // these are rare enough that no such optimization is needed
269266 this.updateTooltipAccessKeys( $( 'input' ) );
270267 this.updateTooltipAccessKeys( $( 'label' ) );
 268+
271269 return;
 270+
 271+ } else if ( nodeList instanceof jQuery ) {
 272+ $nodes = nodeList;
 273+ } else {
 274+ $nodes = $( nodeList );
272275 }
273276
274277 $nodes.each( function ( i ) {
Index: trunk/phase3/resources/mediawiki.page/mediawiki.page.ready.js
@@ -18,4 +18,7 @@
1919 /* Enable CheckboxShiftClick */
2020 $( 'input[type=checkbox]:not(.noshiftselect)' ).checkboxShiftClick();
2121
 22+ /* Add accesskey hints to the tooltips */
 23+ mw.util.updateTooltipAccessKeys();
 24+
2225 } );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r75275adding begin of mediaWiki.util and loading it by default + trailing whitespac...krinkle17:24, 23 October 2010
r75287added mw.util.getWikilink and ported enableCheckboxShiftClick to jQuerykrinkle20:12, 23 October 2010

Status & tagging log