Skip to content

Commit

Permalink
Revert "Landing pull request 461. Adds a due diligence check for pre-…
Browse files Browse the repository at this point in the history
…defined data-* attrs during removal. Fixes #10026."

This reverts commit 6805fc2.

A more cache-friendly solution is in the works.
  • Loading branch information
timmywil committed Aug 22, 2011
1 parent 6805fc2 commit 84f2908
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 17 deletions.
5 changes: 0 additions & 5 deletions src/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,6 @@ jQuery.extend({

delete thisCache[ name ];

// Check the actual element for predefined data-* attrs, #10027
if ( jQuery.attr( elem, "data-" + name ) ) {
jQuery.removeAttr( elem, "data-" + name );
}

// If there is no data left in the cache, we want to continue
// and let the cache object itself get destroyed
if ( !isEmptyDataObject(thisCache) ) {
Expand Down
13 changes: 1 addition & 12 deletions test/unit/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,7 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
"some-json": '{ "foo": "bar" }'
};

expect( 29 );
expect( 27 );

jQuery.each( datas, function( key, val ) {
div.data( key, val );
Expand All @@ -581,15 +581,4 @@ test("jQuery.data supports interoperable removal of hyphenated/camelCase propert
equal( div.data( key ), undefined, "get: " + key );

});

div.remove();

// Covers #10027
div = jQuery("<div data-msg='hello'></div>");

equal( div.data("msg"), "hello", "<div data-msg='hello'></div> has expected data" );

div.removeData("msg");

equal( div.data("msg"), undefined, "data-msg removed correctly" );
});

0 comments on commit 84f2908

Please sign in to comment.