X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=src%2Fdata.js;h=4d1d1bd55615ba2944c9cfa9b44dbdd93c307f2d;hb=a8fa5f2ec1030bceb9a65d0237f0c92ae4e014dd;hp=c3530c835f731a7d34336c53affa4cb39557832d;hpb=f5d4bf8920868c2d1f88cc4f3bfcf85c0b566b2e;p=jquery.git diff --git a/src/data.js b/src/data.js index c3530c8..4d1d1bd 100644 --- a/src/data.js +++ b/src/data.js @@ -10,7 +10,8 @@ jQuery.extend({ uuid: 0, // Unique for each copy of jQuery on the page - expando: "jQuery" + jQuery.now(), + // 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. @@ -22,7 +23,11 @@ jQuery.extend({ }, hasData: function( elem ) { - return !elem.nodeType || (!!elem[ jQuery.expando ] && !jQuery.isEmptyObject(jQuery.cache[ elem[jQuery.expando] ])); + if ( elem.nodeType ) { + elem = jQuery.cache[ elem[jQuery.expando] ]; + } + + return !!elem && !jQuery.isEmptyObject(elem); }, data: function( elem, name, data ) {