From: jeresig Date: Wed, 8 Sep 2010 16:00:29 +0000 (-0400) Subject: Make sure that jQuery works even when the individual modules are loaded separately... X-Git-Tag: 1.4.3rc1~116^2~16 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=a44ec402771f6d622506f39073d0be260400dd21;p=jquery.git Make sure that jQuery works even when the individual modules are loaded separately AND jQuery.noConflict(true) is used. Fixes #7011. --- diff --git a/src/ajax.js b/src/ajax.js index 2c4f13cb2..52a5a22cc 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var jsc = jQuery.now(), rscript = //gi, rselectTextarea = /select|textarea/i, @@ -686,3 +688,5 @@ jQuery.extend( jQuery.ajax, { // For backwards compatibility jQuery.extend( jQuery.ajax ); + +})( jQuery ); diff --git a/src/attributes.js b/src/attributes.js index fecba6617..4fa49b914 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var rclass = /[\n\t]/g, rspace = /\s+/, rreturn = /\r/g, @@ -341,3 +343,5 @@ jQuery.extend({ } } }); + +})( jQuery ); diff --git a/src/css.js b/src/css.js index 2da19b9c3..56249598d 100644 --- a/src/css.js +++ b/src/css.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var ralpha = /alpha\([^)]*\)/, ropacity = /opacity=([^)]*)/, rdashAlpha = /-([a-z])/ig, @@ -238,3 +240,5 @@ if ( jQuery.expr && jQuery.expr.filters ) { return !jQuery.expr.filters.hidden( elem ); }; } + +})( jQuery ); diff --git a/src/data.js b/src/data.js index d38d47d3c..5404c936c 100644 --- a/src/data.js +++ b/src/data.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var windowData = {}; jQuery.extend({ @@ -165,3 +167,5 @@ jQuery.fn.extend({ }); } }); + +})( jQuery ); diff --git a/src/dimensions.js b/src/dimensions.js index 52fd0f86d..58c16af8d 100644 --- a/src/dimensions.js +++ b/src/dimensions.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + // Create innerHeight, innerWidth, outerHeight and outerWidth methods jQuery.each([ "Height", "Width" ], function( i, name ) { @@ -55,3 +57,5 @@ jQuery.each([ "Height", "Width" ], function( i, name ) { }; }); + +})( jQuery ); diff --git a/src/effects.js b/src/effects.js index d31e2e354..130b676f4 100644 --- a/src/effects.js +++ b/src/effects.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var elemdisplay = {}, rfxtypes = /toggle|show|hide/, rfxnum = /^([+\-]=)?([\d+.\-]+)(.*)$/, @@ -480,3 +482,5 @@ if ( jQuery.expr && jQuery.expr.filters ) { }).length; }; } + +})( jQuery ); diff --git a/src/event.js b/src/event.js index 45f2202c5..f0b27de43 100644 --- a/src/event.js +++ b/src/event.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var rnamespaces = /\.(.*)$/, fcleanup = function( nm ) { return nm.replace(/[^\w\s\.\|`]/g, function( ch ) { @@ -1109,3 +1111,5 @@ if ( window.attachEvent && !window.addEventListener ) { } }); } + +})( jQuery ); diff --git a/src/manipulation.js b/src/manipulation.js index cb898cc3c..3054eea1d 100644 --- a/src/manipulation.js +++ b/src/manipulation.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, rleadingWhitespace = /^\s+/, rxhtmlTag = /(<([\w:]+)[^>]*?)\/>/g, @@ -599,4 +601,6 @@ function evalScript( i, elem ) { if ( elem.parentNode ) { elem.parentNode.removeChild( elem ); } -} \ No newline at end of file +} + +})( jQuery ); diff --git a/src/offset.js b/src/offset.js index bab253ba2..5d283aacf 100644 --- a/src/offset.js +++ b/src/offset.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + if ( "getBoundingClientRect" in document.documentElement ) { jQuery.fn.offset = function( options ) { var elem = this[0]; @@ -281,3 +283,5 @@ function getWindow( elem ) { elem.defaultView || elem.parentWindow : false; } + +})( jQuery ); diff --git a/src/queue.js b/src/queue.js index e52f37b85..11c658f5d 100644 --- a/src/queue.js +++ b/src/queue.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + jQuery.extend({ queue: function( elem, type, data ) { if ( !elem ) { @@ -88,3 +90,5 @@ jQuery.fn.extend({ return this.queue( type || "fx", [] ); } }); + +})( jQuery ); diff --git a/src/support.js b/src/support.js index cddd3dc3b..febff1597 100644 --- a/src/support.js +++ b/src/support.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + (function() { jQuery.support = {}; @@ -132,7 +134,7 @@ // release memory in IE root = script = div = all = a = null; -})(); +})( jQuery ); jQuery.props = { "for": "htmlFor", @@ -146,3 +148,5 @@ jQuery.props = { usemap: "useMap", frameborder: "frameBorder" }; + +})( jQuery ); diff --git a/src/traversing.js b/src/traversing.js index fde7219bb..59110b096 100644 --- a/src/traversing.js +++ b/src/traversing.js @@ -1,3 +1,5 @@ +(function( jQuery ) { + var runtil = /Until$/, rparentsprev = /^(?:parents|prevUntil|prevAll)/, // Note: This RegExp should be improved, or likely pulled from Sizzle @@ -271,3 +273,5 @@ function winnow( elements, qualifier, keep ) { return (jQuery.inArray( elem, qualifier ) >= 0) === keep; }); } + +})( jQuery ); diff --git a/test/unit/core.js b/test/unit/core.js index 3ba16a486..811d13fb4 100644 --- a/test/unit/core.js +++ b/test/unit/core.js @@ -183,7 +183,7 @@ test("browser", function() { } test("noConflict", function() { - expect(6); + expect(7); var $$ = jQuery; @@ -196,6 +196,7 @@ test("noConflict", function() { equals( jQuery.noConflict(true), $$, "noConflict returned the jQuery object" ); equals( jQuery, originaljQuery, "Make sure jQuery was reverted." ); equals( $, original$, "Make sure $ was reverted." ); + ok( $$("#main").html("test"), "Make sure that jQuery still works." ); jQuery = $$; });