X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fcore.js;h=b738ce485584f2d31d65b13eef387e4a4f238662;hb=59802928566b6be3a66d65e77c2418fff37e6f5f;hp=3ba2a859d9682d85a0b499d60804ff0c81469dab;hpb=ac00fe5bbb2a95fdb747f76fd9dd7c58ba6a531c;p=jquery.git diff --git a/src/core.js b/src/core.js index 3ba2a85..b738ce4 100644 --- a/src/core.js +++ b/src/core.js @@ -29,10 +29,10 @@ var jQuery = function( selector, context ) { rnotwhite = /\S/, // Used for trimming whitespace - rtrim = /^\s+|\s+$/g, + rtrim = /^(\s|\u00A0)+|(\s|\u00A0)+$/g, // Match a standalone tag - rsingleTag = /<(\w+)\s*\/?>(?:<\/\1>)?$/, + rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, // Keep a UserAgent string for use with jQuery.browser userAgent = navigator.userAgent.toLowerCase(), @@ -273,9 +273,9 @@ jQuery.extend = jQuery.fn.extend = function() { } // Recurse if we're merging object literal values - if ( deep && copy && jQuery.isObjectLiteral(copy) ) { + if ( deep && copy && jQuery.isPlainObject(copy) ) { // Don't extend not object literals - var clone = src && jQuery.isObjectLiteral(src) ? src : {}; + var clone = src && jQuery.isPlainObject(src) ? src : {}; // Never move original objects, clone them target[ name ] = jQuery.extend( deep, clone, copy ); @@ -314,8 +314,8 @@ jQuery.extend({ return toString.call(obj) === "[object Array]"; }, - isObjectLiteral: function( obj ) { - if ( toString.call(obj) !== "[object Object]" ) { + isPlainObject: function( obj ) { + if ( toString.call(obj) !== "[object Object]" || typeof obj.nodeType === "number" ) { return false; } @@ -342,14 +342,6 @@ jQuery.extend({ return true; }, - // check if an element is in a (or is an) XML document - isXMLDoc: function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - return documentElement ? documentElement.nodeName !== "HTML" : false; - }, - // Evalulates a script in a global context globalEval: function( data ) { if ( data && rnotwhite.test(data) ) { @@ -484,13 +476,14 @@ jQuery.extend({ return ret; }, - map: function( elems, callback ) { + // arg is for internal usage only + map: function( elems, callback, arg ) { var ret = [], value; // Go through the array, translating each of the items to their // new value (or values). for ( var i = 0, length = elems.length; i < length; i++ ) { - value = callback( elems[ i ], i ); + value = callback( elems[ i ], i, arg ); if ( value != null ) { ret[ ret.length ] = value;