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.