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 a2731202917f8e90cad94ee574241d1626dc7fb6
Showing with 18 additions and 0 deletions.
  1. +2 −0 src/data.js
  2. +16 −0 test/unit/data.js
@@ -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.
You can’t perform that action at this time.