Make sure that .data() events don't bubble, per the discussion in 2e10af143b. Fixes #6832.

This commit is contained in:
John Resig 2010-07-27 13:45:32 -04:00
parent 646fbea561
commit c4b4df4691
2 changed files with 14 additions and 3 deletions

View file

@ -143,13 +143,18 @@ jQuery.fn.extend({
if ( data === undefined && this.length ) {
data = jQuery.data( this[0], key );
}
return data === undefined && parts[1] ?
this.data( parts[0] ) :
data;
} else {
return this.trigger("setData" + parts[1] + "!", [parts[0], value]).each(function() {
return this.each(function() {
var $this = jQuery( this ), args = [ parts[0], value ];
$this.triggerHandler( "setData" + parts[1] + "!", args );
jQuery.data( this, key, value );
jQuery.event.trigger( "changeData" + parts[1] + "!", [parts[0], value], this );
$this.triggerHandler( "changeData" + parts[1] + "!", args );
});
}
},