diff options
author | Colin Snover <github.com@zetafleet.com> | 2010-12-19 15:33:53 -0600 |
---|---|---|
committer | Colin Snover <github.com@zetafleet.com> | 2010-12-19 15:33:53 -0600 |
commit | faefbb1ad0b81e8001b582d06d5bd9c9236e62ce (patch) | |
tree | 608ced365e940684a0a2572d365ff97ad50a7863 /src/data.js | |
parent | 291b1edf444f30d9360a42c8d563e26eaf1a2ddb (diff) | |
download | jquery-faefbb1ad0b81e8001b582d06d5bd9c9236e62ce.tar.gz jquery-faefbb1ad0b81e8001b582d06d5bd9c9236e62ce.zip |
Fix #7717 and #7165. Thanks to dmethvin and iliakan for their help fixing these issues.
Diffstat (limited to 'src/data.js')
-rw-r--r-- | src/data.js | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/data.js b/src/data.js index f1e031fff..120fe718d 100644 --- a/src/data.js +++ b/src/data.js @@ -9,7 +9,7 @@ jQuery.extend({ // Please use with caution uuid: 0, - // Unique for each copy of jQuery on the page + // Unique for each copy of jQuery on the page expando: "jQuery" + jQuery.now(), // The following elements throw uncatchable exceptions if you @@ -21,6 +21,10 @@ jQuery.extend({ "applet": true }, + hasData: function( elem ) { + return !elem.nodeType || (elem[ jQuery.expando ] && !jQuery.isEmptyObject(jQuery.cache[ elem[jQuery.expando] ])); + }, + data: function( elem, name, data ) { if ( !jQuery.acceptData( elem ) ) { return; @@ -144,7 +148,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 ] ); |