]> source.dussan.org Git - jquery.git/commitdiff
Fix #12229, size/consistency improvements. Close gh-887.
authorRichard Gibson <richard.gibson@gmail.com>
Tue, 18 Sep 2012 21:39:44 +0000 (17:39 -0400)
committerDave Methvin <dave.methvin@gmail.com>
Tue, 18 Sep 2012 22:04:31 +0000 (18:04 -0400)
src/ajax.js
src/attributes.js
src/core.js
src/data.js
src/event.js

index cfbfcd5272b2d92a52d683f7c753943598f8619d..5e1fb2d9433e81ad34a60126678e0e842bb23031 100644 (file)
@@ -1,7 +1,7 @@
-var // Document location
-       ajaxLocation,
-       // Document location segments
+var
+       // Document location
        ajaxLocParts,
+       ajaxLocation,
 
        rhash = /#.*$/,
        rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
@@ -518,7 +518,7 @@ jQuery.extend({
 
                        // Set data for the fake xhr object
                        jqXHR.status = status;
-                       jqXHR.statusText = "" + ( nativeStatusText || statusText );
+                       jqXHR.statusText = ( nativeStatusText || statusText ) + "";
 
                        // Success/Error
                        if ( isSuccess ) {
@@ -578,14 +578,11 @@ jQuery.extend({
                // Extract dataTypes list
                s.dataTypes = jQuery.trim( s.dataType || "*" ).toLowerCase().split( core_rspace );
 
-               // Determine if a cross-domain request is in order
+               // A cross-domain request is in order when we have a protocol:host:port mismatch
                if ( s.crossDomain == null ) {
-                       parts = rurl.exec( s.url.toLowerCase() );
-                       s.crossDomain = !!( parts &&
-                               ( parts[ 1 ] != ajaxLocParts[ 1 ] || parts[ 2 ] != ajaxLocParts[ 2 ] ||
-                                       ( parts[ 3 ] || ( parts[ 1 ] === "http:" ? 80 : 443 ) ) !=
-                                               ( ajaxLocParts[ 3 ] || ( ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) ) )
-                       );
+                       parts = rurl.exec( s.url.toLowerCase() ) || false;
+                       s.crossDomain = parts && ( parts.join(":") + ( parts[ 3 ] ? "" : parts[ 1 ] === "http:" ? 80 : 443 ) ) !==
+                               ( ajaxLocParts.join(":") + ( ajaxLocParts[ 3 ] ? "" : ajaxLocParts[ 1 ] === "http:" ? 80 : 443 ) );
                }
 
                // Convert data if not already a string
index aeb4e0f9f079595575c73bb940655f78ea68e164..cde7e4732f805cffb0a3eb63608c60123f43001c 100644 (file)
@@ -57,7 +57,7 @@ jQuery.fn.extend({
                                                setClass = " " + elem.className + " ";
 
                                                for ( c = 0, cl = classNames.length; c < cl; c++ ) {
-                                                       if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) {
+                                                       if ( setClass.indexOf( " " + classNames[ c ] + " " ) < 0 ) {
                                                                setClass += classNames[ c ] + " ";
                                                        }
                                                }
@@ -90,7 +90,7 @@ jQuery.fn.extend({
                                        // loop over each item in the removal list
                                        for ( c = 0, cl = removes.length; c < cl; c++ ) {
                                                // Remove until there is nothing to remove,
-                                               while ( className.indexOf(" " + removes[ c ] + " ") > -1 ) {
+                                               while ( className.indexOf(" " + removes[ c ] + " ") >= 0 ) {
                                                        className = className.replace( " " + removes[ c ] + " " , " " );
                                                }
                                        }
@@ -144,7 +144,7 @@ jQuery.fn.extend({
                        i = 0,
                        l = this.length;
                for ( ; i < l; i++ ) {
-                       if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) {
+                       if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) >= 0 ) {
                                return true;
                        }
                }
@@ -322,7 +322,7 @@ jQuery.extend({
                                return ret;
 
                        } else {
-                               elem.setAttribute( name, "" + value );
+                               elem.setAttribute( name, value + "" );
                                return value;
                        }
 
@@ -586,7 +586,7 @@ if ( !jQuery.support.style ) {
                        return elem.style.cssText.toLowerCase() || undefined;
                },
                set: function( elem, value ) {
-                       return ( elem.style.cssText = "" + value );
+                       return ( elem.style.cssText = value + "" );
                }
        };
 }
index 916e7ad8d7e80d990a9f427e87ac0d6c8fa93d9a..709467168907bf67568176049b9449730c932ab6 100644 (file)
@@ -559,7 +559,7 @@ jQuery.extend({
        },
 
        nodeName: function( elem, name ) {
-               return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase();
+               return elem.nodeName && elem.nodeName.toLowerCase() === name.toLowerCase();
        },
 
        // args is for internal usage only
@@ -616,7 +616,7 @@ jQuery.extend({
                function( text ) {
                        return text == null ?
                                "" :
-                               text.toString().replace( rtrim, "" );
+                               ( text + "" ).replace( rtrim, "" );
                },
 
        // results is for internal usage only
@@ -762,7 +762,7 @@ jQuery.extend({
                };
 
                // Set the guid of unique handler to the same of original handler, so it can be removed
-               proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++;
+               proxy.guid = fn.guid = fn.guid || jQuery.guid++;
 
                return proxy;
        },
index e5c3df6986e64bb63b55299a43ee5d23a96f932b..7d9bef3e1227c57109ca3446869e0e3fd2ecc61d 100644 (file)
@@ -6,7 +6,7 @@ jQuery.extend({
 
        deletedIds: [],
 
-       // Please use with caution
+       // Remove at next major release (1.9/2.0)
        uuid: 0,
 
        // Unique for each copy of jQuery on the page
@@ -58,7 +58,7 @@ jQuery.extend({
                        // Only DOM nodes need a new unique ID for each element since their data
                        // ends up in the global cache
                        if ( isNode ) {
-                               elem[ internalKey ] = id = jQuery.deletedIds.pop() || ++jQuery.uuid;
+                               elem[ internalKey ] = id = jQuery.deletedIds.pop() || jQuery.guid++;
                        } else {
                                id = internalKey;
                        }
@@ -232,7 +232,7 @@ jQuery.fn.extend({
                                        for ( l = attr.length; i < l; i++ ) {
                                                name = attr[i].name;
 
-                                               if ( name.indexOf( "data-" ) === 0 ) {
+                                               if ( !name.indexOf( "data-" ) ) {
                                                        name = jQuery.camelCase( name.substring(5) );
 
                                                        dataAttr( elem, name, data[ name ] );
index c9231dabb1cf861ab8148b5d3fb7540bd10076c2..c92dd4206115c9539ecbf5cc46d723fc2c74b185 100644 (file)
@@ -365,7 +365,7 @@ jQuery.event = {
                var i, j, cur, ret, selMatch, matched, matches, handleObj, sel, related,
                        handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []),
                        delegateCount = handlers.delegateCount,
-                       args = [].slice.call( arguments ),
+                       args = core_slice.call( arguments ),
                        run_all = !event.exclusive && !event.namespace,
                        special = jQuery.event.special[ event.type ] || {},
                        handlerQueue = [];
@@ -966,7 +966,7 @@ jQuery.fn.extend({
        },
        undelegate: function( selector, types, fn ) {
                // ( namespace ) or ( selector, types [, fn] )
-               return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
+               return arguments.length === 1 ? this.off( selector, "**" ) : this.off( types, selector || "**", fn );
        },
 
        trigger: function( type, data ) {