X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;f=src%2Fcore.js;h=e7efb655612b90f4f38bdedddbff5f2ec9f10f7e;hb=a43a5ca9cf79afcd662df5b9110d7ccba45c0b53;hp=422b68876640216555821acd99f25e7e098165db;hpb=ab1d9a8a2c296a2fa31b7d15146ce115c4057fad;p=jquery.git diff --git a/src/core.js b/src/core.js index 422b688..e7efb65 100644 --- a/src/core.js +++ b/src/core.js @@ -294,7 +294,7 @@ jQuery.fn = jQuery.prototype = { jQuery.fn.init.prototype = jQuery.fn; jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, + var options, name, src, copy, copyIsArray, clone, target = arguments[0] || {}, i = 1, length = arguments.length, @@ -566,10 +566,8 @@ jQuery.extend({ if ( data && rnotwhite.test(data) ) { // Inspired by code by Andrea Giammarchi // http://webreflection.blogspot.com/2007/08/global-scope-evaluation-and-dom.html - var head = document.getElementsByTagName("head")[0] || document.documentElement, - script = document.createElement("script"); - - script.type = "text/javascript"; + var head = document.head || document.getElementsByTagName( "head" )[0] || document.documentElement, + script = document.createElement( "script" ); if ( jQuery.support.scriptEval() ) { script.appendChild( document.createTextNode( data ) ); @@ -957,18 +955,20 @@ jQuery.extend({ return { browser: match[1] || "", version: match[2] || "0" }; }, - subclass: function(){ + sub: function() { function jQuerySubclass( selector, context ) { return new jQuerySubclass.fn.init( selector, context ); } + jQuery.extend( true, jQuerySubclass, this ); jQuerySubclass.superclass = this; jQuerySubclass.fn = jQuerySubclass.prototype = this(); jQuerySubclass.fn.constructor = jQuerySubclass; jQuerySubclass.subclass = this.subclass; jQuerySubclass.fn.init = function init( selector, context ) { - if (context && context instanceof jQuery && !(context instanceof jQuerySubclass)){ + if ( context && context instanceof jQuery && !(context instanceof jQuerySubclass) ) { context = jQuerySubclass(context); } + return jQuery.fn.init.call( this, selector, context, rootjQuerySubclass ); }; jQuerySubclass.fn.init.prototype = jQuerySubclass.fn; @@ -1050,6 +1050,6 @@ function doScrollCheck() { } // Expose jQuery to the global object -return (window.jQuery = window.$ = jQuery); +return jQuery; })();