Skip to content
Permalink
Browse files
jquery data: closes #5224. Exposing the expando.
  • Loading branch information
flesler committed Sep 14, 2009
1 parent 173c147 commit a273120
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
@@ -2,6 +2,8 @@ var expando = "jQuery" + now(), uuid = 0, windowData = {};

jQuery.extend({
cache: {},

expando:expando,

data: function( elem, name, data ) {
elem = elem == window ?
@@ -1,5 +1,21 @@
module("data");

test("expando", function(){
expect(4);

equals("expando" in jQuery, true, "jQuery is exposing the expando");

var obj = {};
jQuery.data(obj, "foo", "bar");

equals(jQuery.expando in obj, true, "jQuery.data added an expando to the object");

var id = obj[jQuery.expando];
equals( id in jQuery.cache, true, "jQuery.data added an entry to jQuery.cache");

equals( jQuery.cache[id].foo, "bar", "jQuery.data worked correctly");
});

test("jQuery.data", function() {
expect(5);
var div = jQuery("#foo")[0];

0 comments on commit a273120

Please sign in to comment.