r63803 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r63802‎ | r63803 | r63804 >
Date:05:58, 16 March 2010
Author:dale
Status:deferred
Tags:
Comment:
some noConflict tweeks
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/mwEmbed.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/mwEmbed.js
@@ -2459,10 +2459,7 @@
24602460 // Make sure we have jQuery:
24612461 mw.load( 'window.jQuery', function() {
24622462 if ( ! window['$j'] ) {
2463 - // Don't use noConflict() since other web embeding context may
2464 - // have mixed use of $ aliased to jQuery or not but would
2465 - // mannage it themselves with use of jQuery.noConflict();
2466 - window['$j'] = jQuery;
 2463+ window['$j'] = jQuery.noConflict();
24672464 }
24682465 mw.setConfig( 'jquery_skin_path', mw.getMwEmbedPath() + 'jquery/jquery.ui/themes/' + mw.getConfig( 'jQueryUISkin' ) + '/' );
24692466
@@ -2901,10 +2898,17 @@
29022899 mwCheckBody();
29032900 }, 250);
29042901
2905 -// If window.jQuery is already avaliable set mapping before setup
2906 -// ( we don't use noConflict since other pages that include
2907 -// mwEmbed may depend on $ = jQuery, with a simple
2908 -// alias we should be fine
 2902+// Somewhat weird hack to keep jQuery in $ when its
 2903+// already there, but also use noConflict to get $j.
29092904 if( window.jQuery ){
2910 - window['$j'] = jQuery();
2911 -}
\ No newline at end of file
 2905+ var dollarFlag = false;
 2906+ if( $ && $.fn && $.fn.jquery ){
 2907+ // NOTE we could check the version of
 2908+ // jQuery and do a removal call if too old
 2909+ dollarFlag = true;
 2910+ }
 2911+ window['$j'] = jQuery.noConflict();
 2912+ if( dollarFlag ) {
 2913+ window['$'] = jQuery.noConflict();
 2914+ }
 2915+}

Status & tagging log