Pathoschild/Wikimedia-contrib — pull request #11 by Krinkle (2013-01-05 23:17:59+00:00)
Title: forceltr: Optimisation and clean up

* Use 'html' instead of html:first. ":first" is a proprietary jQuery selector
which means it initialised all of Sizzle (:first-child would be better).
But in this case it doesn't make sense as there can only be one .

* Chain jQuery methods $foo.bar().quux() instead of $foo.bar(); $foo.quux();

* Use .attr() instead of .each() + attr() + attr().
.attr() already iterated over "all" elements in the collection and
supports a callback to allow dynamically setting the new value based on
the current value.

This saves a loop and 2 jQuery calls (no extra $() and no
extra attr() for reading/setting).

* Use '[dir]' instead of '*[dir]'

* Also swap body.sitedir-rtl and body.rtl
add/removeClass supports space-separated values (regardless of their order).

* Pass Initialize function by reference to $() instead of creating another
function just to call one function.