jQuery
jQuery è una libreria JavaScript progettata per semplificare lo sviluppo indipendentemente dal browser. Stiamo distribuendo la libreria JavaScript jQuery a partire dal rilascio 1.16.
Versione
MediaWiki | jQuery | Note |
---|---|---|
jQuery 3.2.1 | Including jQuery Migrate v3.0.0. See also $wgUsejQueryThree (removed in MW 1.31) and task T124742. | |
MediaWiki 1.28 |
jQuery 1.11.3 | git #d898e80f, git #acfa9695 |
MediaWiki 1.24.2 | jQuery 1.11.2 | |
MediaWiki 1.24 | jQuery 1.11.1 (con jQuery Migrate) | git #e5502d1f, git #63c36506, git #8e41082a |
MediaWiki 1.23 |
jQuery 1.8.3 | |
MediaWiki 1.20 | jQuery 1.8.2 | task T31100, git #3b85ab06, |
MediaWiki 1.19 | jQuery 1.7.1 | r105612 |
MediaWiki 1.18 | jQuery 1.6.4 | task T30904, task T31773 |
MediaWiki 1.17 | jQuery 1.4.2 | r65962 |
MediaWiki 1.16 | jQuery 1.3.2 |
ResourceLoader
MediaWiki versione: | ≥ 1.17 |
As of MediaWiki 1.17 all resources are (or should be) loaded through ResourceLoader. The default modules are stored in /resources
. There are no static minified versions anymore as ResourceLoader takes care of this when combining and optimizing all queued files.
All code can assume that jQuery has already been loaded.
However, if your site skin was created prior to 1.17, ResourceLoader will not be loaded and jQuery will not be available.
Before ResourceLoader
MediaWiki versione: | ≤ 1.16 |
MediaWiki 1.16 shipped with jQuery version 1.3.2 with some patches by Trevor Parscal and Roan Kattouw to fix jQuery bug #5081 (see r60697 and r61700).
In 1.16, the jQuery file is in skins/common/jquery.js
and the minified version is jquery-min.js
in the same directory.
Extensions can use OutputPage's includeJQuery method, which has existed since r61431, to avoid loading minified version of jQuery core multiple times. It should be noted that includeJQuery does not support jQuery plugins and such.
To include it, paste the following at the bottom of LocalSettings.php :
// Include jQuery
function wfIncludeJQuery() {
global $wgOut;
$wgOut->includeJQuery();
}
$wgExtensionFunctions[] = 'wfIncludeJQuery';
MediaWiki 1.16: jQuery.noConflict
Please pay attention to the fact that, to avoid conflicts with other libraries using $
(since jQuery was not yet the default), in MediaWiki 1.16 jQuery is loaded in noConflict() mode as $j
.
You can use either jQuery
, $j
or something like the following to locally alias it:
( function ( $ ) {
// Simple closure, where $ is available as alias for jQuery.
// Code here will be executed immediately
}( jQuery ) );
Vedi anche
External links
- jQuery.com, the official jQuery site
- jQuery Dialog error in IE7. Runtime error: invalid argument - The Dev Pages — the reason why we patched our jQuery