*/\r
\r
// Map over jQuery in case of overwrite\r
-if ( typeof jQuery != "undefined" )\r
- var _jQuery = jQuery;\r
+if ( window.jQuery )\r
+ var _jQuery = window.jQuery;\r
\r
var jQuery = window.jQuery = function( selector, context ) {\r
// If the context is a namespace object, return a new object\r
};\r
\r
// Map over the $ in case of overwrite\r
-if ( typeof $ != "undefined" )\r
- var _$ = $;\r
+if ( window.$ )\r
+ var _$ = window.$;\r
\r
// Map the jQuery namespace to the '$' one\r
window.$ = jQuery;\r
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>jQuery Test Suite</title>
<link rel="Stylesheet" media="screen" href="data/testsuite.css" />
+ <script>var jQuery = "jQuery", $ = "$"; // For testing .noConflcit()</script>
<script type="text/javascript" src="../dist/jquery.js"></script>
<script type="text/javascript" src="data/testrunner.js"></script>
<script type="text/javascript" src="unit/core.js"></script>
equals( div.length, 4, "Correct number of elements generated for div hr code b" );
});
+test("noConflict", function() {
+ expect(6);
+
+ var old = jQuery;
+ var newjQuery = jQuery.noConflict();
+
+ ok( newjQuery == old, "noConflict returned the jQuery object" );
+ ok( jQuery == old, "Make sure jQuery wasn't touched." );
+ ok( $ == "$", "Make sure $ was reverted." );
+
+ jQuery = $ = old;
+
+ newjQuery = jQuery.noConflict(true);
+
+ ok( newjQuery == old, "noConflict returned the jQuery object" );
+ ok( jQuery == "jQuery", "Make sure jQuery was reverted." );
+ ok( $ == "$", "Make sure $ was reverted." );
+
+ jQuery = $ = old;
+});
+
test("isFunction", function() {
expect(21);