aboutsummaryrefslogtreecommitdiffstats
path: root/src/data.js
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2012-10-31 13:55:51 -0400
committerDave Methvin <dave.methvin@gmail.com>2012-10-31 21:27:42 -0400
commite8cf41a051a62bf1f19beab1a5c1d643f121e28e (patch)
treed7b837d94652883ee04254387e61f9b3cf5ebe22 /src/data.js
parent6e75fe5f1945893cce3ced481e586d8ad6cbfa1d (diff)
downloadjquery-e8cf41a051a62bf1f19beab1a5c1d643f121e28e.tar.gz
jquery-e8cf41a051a62bf1f19beab1a5c1d643f121e28e.zip
Fix #10544. Remove deprecated .data() event namespaced triggering.
Data events were horribly slow, never documented, and caused strange interpretation of data items with dots in them.
Diffstat (limited to 'src/data.js')
-rw-r--r--src/data.js28
1 files changed, 5 insertions, 23 deletions
diff --git a/src/data.js b/src/data.js
index eb682feab..af5f7c16f 100644
--- a/src/data.js
+++ b/src/data.js
@@ -232,7 +232,7 @@ jQuery.extend({
jQuery.fn.extend({
data: function( key, value ) {
- var parts, part, attr, name, l,
+ var attrs, name,
elem = this[0],
i = 0,
data = null;
@@ -243,9 +243,9 @@ jQuery.fn.extend({
data = jQuery.data( elem );
if ( elem.nodeType === 1 && !jQuery._data( elem, "parsedAttrs" ) ) {
- attr = elem.attributes;
- for ( l = attr.length; i < l; i++ ) {
- name = attr[i].name;
+ attrs = elem.attributes;
+ for ( ; i < attrs.length; i++ ) {
+ name = attrs[i].name;
if ( !name.indexOf( "data-" ) ) {
name = jQuery.camelCase( name.substring(5) );
@@ -267,33 +267,15 @@ jQuery.fn.extend({
});
}
- parts = key.split( ".", 2 );
- parts[1] = parts[1] ? "." + parts[1] : "";
- part = parts[1] + "!";
-
return jQuery.access( this, function( value ) {
if ( value === undefined ) {
- data = this.triggerHandler( "getData" + part, [ parts[0] ] );
-
// Try to fetch any internally stored data first
- if ( data === undefined && elem ) {
- data = jQuery.data( elem, key );
- data = dataAttr( elem, key, data );
- }
-
- return data === undefined && parts[1] ?
- this.data( parts[0] ) :
- data;
+ return elem ? dataAttr( elem, key, jQuery.data( elem, key ) ) : null;
}
- parts[1] = value;
this.each(function() {
- var self = jQuery( this );
-
- self.triggerHandler( "setData" + part, parts );
jQuery.data( this, key, value );
- self.triggerHandler( "changeData" + part, parts );
});
}, null, value, arguments.length > 1, null, false );
},