git.asbjorn.biz
/
jquery.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Clearing event handlers on unload is no longer necessary in any version of IE. This...
[jquery.git]
/
src
/
data.js
diff --git
a/src/data.js
b/src/data.js
index
0407f73
..
21b7543
100644
(file)
--- a/
src/data.js
+++ b/
src/data.js
@@
-9,7
+9,7
@@
jQuery.extend({
// Please use with caution
uuid: 0,
// 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
expando: "jQuery" + jQuery.now(),
// The following elements throw uncatchable exceptions if you
@@
-21,6
+21,14
@@
jQuery.extend({
"applet": true
},
"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;
data: function( elem, name, data ) {
if ( !jQuery.acceptData( elem ) ) {
return;
@@
-138,15
+146,17
@@
jQuery.fn.extend({
if ( typeof key === "undefined" ) {
if ( this.length ) {
if ( typeof key === "undefined" ) {
if ( this.length ) {
- var attr = this[0].attributes, name;
data = jQuery.data( this[0] );
data = jQuery.data( this[0] );
- for ( var i = 0, l = attr.length; i < l; i++ ) {
- name = attr[i].name;
+ if ( this[0].nodeType === 1 ) {
+ 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 ] );
+ if ( name.indexOf( "data-" ) === 0 ) {
+ name = name.substr( 5 );
+ dataAttr( this[0], name, data[ name ] );
+ }
}
}
}
}
}
}
@@
-177,7
+187,8
@@
jQuery.fn.extend({
} else {
return this.each(function() {
} else {
return this.each(function() {
- var $this = jQuery( this ), args = [ parts[0], value ];
+ var $this = jQuery( this ),
+ args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );