Three small fixes to mediawiki.specials.preferences.js
authorKrinkle <krinkle@users.mediawiki.org>
Sun, 6 Feb 2011 03:31:32 +0000 (03:31 +0000)
committerKrinkle <krinkle@users.mediawiki.org>
Sun, 6 Feb 2011 03:31:32 +0000 (03:31 +0000)
commit786a25f8043b5782d21dd124f94de449576b8f01
treeba1f746e25ef614e6b8385ebc1a656e0e1ff3d41
parent4625f338cacae413af67ec918e644e7b167b05fb
Three small fixes to mediawiki.specials.preferences.js
* Moving class-adder from mousedown() to click().

Mousedown also fires when opening the contextmenu (right-click). If I right-clicked, say, preftab-4 to open in a new tab, it would work (thanks to r81573), but it would also trigger the 'selected'-class on that tab (which is wrong and out-of-sync since click() did not and should not fire). This behaviour was the case in Safari 5/Firefox 3 (Mac) and Chrome (Windows). Moving it to click() should not have any affect on the behaviour in other browsers.
Test it at: http://api.jquery.com/mousedown/

* Wrapping the hash-jump in a document.ready function.

This module is enclosed in a self-executing anonymous function to enforce private scope passing mediaWiki and jQuery. Although that, (<code>(function($,mw){ /* ... */ })(jQuery,mediaWiki);</code>) may look like a shortcut for jQuery(document).ready(), it is not. (Because both <code>;</code> and <code>jQuery(function{ /* ... */ });</code> look alike and are shortcuts). Anyway, wrapping it now to avoid it jumping too early.

* Using second argument of .each(), which is a reference to 'this'

By using that (named) variable instead there's no confusion with the other 'this' inside the click event binder – which refers to the then-clicked element (the anchor tag) rather than the legend-element.
resources/mediawiki.special/mediawiki.special.preferences.js