Moved unload abort code so that the event is only bound if the xhr transport is used...
[jquery.git] / src / data.js
index f1e031f..4d1d1bd 100644 (file)
@@ -9,8 +9,9 @@ jQuery.extend({
        // Please use with caution
        uuid: 0,
 
-       // Unique for each copy of jQuery on the page   
-       expando: "jQuery" + jQuery.now(),
+       // Unique for each copy of jQuery on the page
+       // Non-digits removed to match rinlinejQuery
+       expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ),
 
        // The following elements throw uncatchable exceptions if you
        // attempt to add expando properties to them.
@@ -21,6 +22,14 @@ jQuery.extend({
                "applet": true
        },
 
+       hasData: function( elem ) {
+               if ( elem.nodeType ) {
+                       elem = jQuery.cache[ elem[jQuery.expando] ];
+               }
+
+               return !!elem && !jQuery.isEmptyObject(elem);
+       },
+
        data: function( elem, name, data ) {
                if ( !jQuery.acceptData( elem ) ) {
                        return;
@@ -144,7 +153,7 @@ jQuery.fn.extend({
                                        var attr = this[0].attributes, name;
                                        for ( var i = 0, l = attr.length; i < l; i++ ) {
                                                name = attr[i].name;
-       
+
                                                if ( name.indexOf( "data-" ) === 0 ) {
                                                        name = name.substr( 5 );
                                                        dataAttr( this[0], name, data[ name ] );