resourceloader: Pass jQuery twice to 'implements' module wrapper
authorOri Livneh <ori@wikimedia.org>
Mon, 23 Sep 2013 01:20:25 +0000 (18:20 -0700)
committerKrinkle <krinklemail@gmail.com>
Tue, 11 Mar 2014 23:05:55 +0000 (23:05 +0000)
commit387de2629ae2da7fa47d568d8fe7fa755e359ccf
tree170c2e66ab362324ac3bec63711fb30244fef300
parenta3af8ab9199a27a00ea1a9bc509f6cf0bdce46b0
resourceloader: Pass jQuery twice to 'implements' module wrapper

This must be done in two parts. A follow-up change will update the wrapper
signature in ResourceLoader::makeLoaderImplementScript to bind the
arguments to '$' and 'jQuery'.

Because almost all event-handling and DOM interaction is mediated by
jQuery, ResourceLoader could provide a per-module breakdown of the work
performed on each page view by passing each module a copy of the jQuery
object that wraps certain functions (like jQuery.fn.on) in module-aware
profiling code. I expect that profiling would only be enabled on a small
fraction of requests. The effect on ordinary page-views would be a
possible small speed-up as a result of jQuery look-ups resolving in
module (rather than global) scope, but I expect the difference to be
neglible and it is not a part of my motivation.

Because ResourceLoader must bind both '$' and 'jQuery' to module scope,
we pass jQuery twice. A separate commit will update the wrapper function's
signature in ResourceLoader::makeLoaderImplementScript. This has to happen
separately to ensure that no module binds jQuery to undefined due to
being loaded by an out-of-sync version of mediawiki.js.

Change-Id: I0c9edac359ceb16fc273de1e51ea70322f18353e
resources/mediawiki/mediawiki.js