Data: test that delete is not used on DOM nodes

(test cherry-picked from 0e982433eb)

Closes gh-2479
This commit is contained in:
Jason Bedard
2015-09-08 20:30:54 +02:00
committed by Michał Gołębiowski
parent 29266e00e9
commit 5a7674d635

View File

@@ -2725,6 +2725,30 @@ QUnit.test( "Inline event result is returned (#13993)", function( assert ) {
assert.equal( result, 42, "inline handler returned value" );
} );
QUnit.test( ".off() removes the expando when there's no more data", function( assert ) {
assert.expect( 2 );
var key,
div = jQuery( "<div/>" ).appendTo( "#qunit-fixture" );
div.on( "click", false );
div.on( "custom", function() {
assert.ok( true, "Custom event triggered" );
} );
div.trigger( "custom" );
div.off( "click custom" );
// Make sure the expando is gone
for ( key in div[ 0 ] ) {
if ( /^jQuery/.test( key ) ) {
assert.strictEqual(
div[ 0 ][ key ], undefined,
"Expando was not removed when there was no more data"
);
}
}
} );
QUnit.test( "preventDefault() on focusin does not throw exception", function( assert ) {
assert.expect( 1 );