Skip to content

Commit 0874096

Browse files
jbedardmgol
authored andcommitted
Tests: do not create data cache when fetching single property
(test cherry-picked from f5bf9bc) Refs gh-2554
1 parent bec2ba2 commit 0874096

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/unit/data.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1121,3 +1121,19 @@ testIframeWithCallback(
11211121
);
11221122
}
11231123
);
1124+
1125+
QUnit.test( ".data(prop) does not create expando", function( assert ) {
1126+
assert.expect( 1 );
1127+
1128+
var key,
1129+
div = jQuery( "<div/>" );
1130+
1131+
div.data("foo");
1132+
assert.equal( false, jQuery.hasData( div[0] ) );
1133+
// Make sure no expando has been added
1134+
for ( key in div[ 0 ] ) {
1135+
if ( /^jQuery/.test( key ) ) {
1136+
assert.ok( false, "Expando was created on access" );
1137+
}
1138+
}
1139+
} );

0 commit comments

Comments
 (0)