import rnothtmlwhite from "./var/rnothtmlwhite.js";
import rcheckableType from "./var/rcheckableType.js";
import slice from "./var/slice.js";
+import acceptData from "./data/var/acceptData.js";
import dataPriv from "./data/var/dataPriv.js";
import nodeName from "./core/nodeName.js";
special, handlers, type, namespaces, origType,
elemData = dataPriv.get( elem );
- // Don't attach events to noData or text/comment nodes (but allow plain objects)
- if ( !elemData ) {
+ // Only attach events to objects that accept data
+ if ( !acceptData( elem ) ) {
return;
}
}, QUnit.config.testTimeout / 4 || 1000 );
} );
+QUnit.test( ".on('focus', fn) on a text node doesn't throw", function( assert ) {
+ assert.expect( 1 );
+
+ jQuery( document.createTextNode( "text" ) )
+ .on( "focus", function() {} );
+
+ assert.ok( true, "No crash" );
+} );
+
QUnit.test( "Donor event interference", function( assert ) {
assert.expect( 8 );