X-Git-Url: https://git.cyclocoop.org/?a=blobdiff_plain;f=resources%2Fsrc%2Fmediawiki%2Fmediawiki.js;h=65488960935b549b40e5d5d3959628a8c1a735ea;hb=0ac4f99804c48c0193238ca1b479ab07db010105;hp=2c88e93654bcd3ddc0a450bfdd33d8e5bc79e242;hpb=f873b499650ef5d27570f9cb96d01d1477f9e089;p=lhc%2Fweb%2Fwiklou.git diff --git a/resources/src/mediawiki/mediawiki.js b/resources/src/mediawiki/mediawiki.js index 2c88e93654..6548896093 100644 --- a/resources/src/mediawiki/mediawiki.js +++ b/resources/src/mediawiki/mediawiki.js @@ -819,6 +819,14 @@ function addEmbeddedCSS( cssText, callback ) { var $style, styleEl; + function fireCallbacks() { + var oldCallbacks = cssCallbacks; + // Reset cssCallbacks variable so it's not polluted by any calls to + // addEmbeddedCSS() from one of the callbacks (T105973) + cssCallbacks = $.Callbacks(); + oldCallbacks.fire().empty(); + } + if ( callback ) { cssCallbacks.add( callback ); } @@ -884,14 +892,14 @@ } else { styleEl.appendChild( document.createTextNode( cssText ) ); } - cssCallbacks.fire().empty(); + fireCallbacks(); return; } } $( newStyleTag( cssText, getMarker() ) ).data( 'ResourceLoaderDynamicStyleTag', true ); - cssCallbacks.fire().empty(); + fireCallbacks(); } /** @@ -1103,39 +1111,24 @@ } /** - * Adds a script tag to the DOM, either using document.write or low-level DOM manipulation, - * depending on whether document-ready has occurred yet and whether we are in async mode. + * Load and execute a script with callback. * * @private * @param {string} src URL to script, will be used as the src attribute in the script tag * @param {Function} [callback] Callback which will be run when the script is done - * @param {boolean} [async=false] Whether to load modules asynchronously. - * Ignored (and defaulted to `true`) if the document-ready event has already occurred. */ - function addScript( src, callback, async ) { - // Using isReady directly instead of storing it locally from a $().ready callback (bug 31895) - if ( $.isReady || async ) { - $.ajax( { - url: src, - dataType: 'script', - // Force jQuery behaviour to be for crossDomain. Otherwise jQuery would use - // XHR for a same domain request instead of