Make sure that jQuery.data( elem ) always returns a data object, fixes #5971. Improve the performance of .bind() and .unbind(), fixes #5972.

This commit is contained in:
jeresig 2010-01-28 14:12:44 -05:00
parent 942f8f7f75
commit eed69eccc5
3 changed files with 92 additions and 58 deletions

View file

@ -1,20 +1,19 @@
module("data");
test("expando", function(){
expect(7);
expect(6);
equals("expando" in jQuery, true, "jQuery is exposing the expando");
var obj = {};
jQuery.data(obj);
equals( jQuery.expando in obj, false, "jQuery.data did not add an expando to the object" );
jQuery.data(obj, true);
equals( jQuery.expando in obj, false, "jQuery.data did not add an expando to the object" );
equals( jQuery.expando in obj, true, "jQuery.data adds an expando to the object" );
obj = {};
jQuery.data(obj, 'test');
equals( jQuery.expando in obj, false, "jQuery.data did not add an expando to the object" );
obj = {};
jQuery.data(obj, "foo", "bar");
equals( jQuery.expando in obj, true, "jQuery.data added an expando to the object" );