Commit a2731202 authored by Ariel Flesler's avatar Ariel Flesler

jquery data: closes #5224. Exposing the expando.

parent 173c1477
...@@ -2,6 +2,8 @@ var expando = "jQuery" + now(), uuid = 0, windowData = {}; ...@@ -2,6 +2,8 @@ var expando = "jQuery" + now(), uuid = 0, windowData = {};
jQuery.extend({ jQuery.extend({
cache: {}, cache: {},
expando:expando,
data: function( elem, name, data ) { data: function( elem, name, data ) {
elem = elem == window ? elem = elem == window ?
......
module("data"); 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() { test("jQuery.data", function() {
expect(5); expect(5);
var div = jQuery("#foo")[0]; var div = jQuery("#foo")[0];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment