Renamed isObjectLiteral to isPlainObject (makes more sense, per the suggestion of...
[jquery.git] / src / core.js
index bdc6b2f..4091111 100644 (file)
@@ -32,7 +32,7 @@ var jQuery = function( selector, context ) {
        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;
                }
                
@@ -484,13 +484,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;