@@ -1289,17 +1289,19 @@ QUnit.test( "Delegated events in SVG (#10791; #13180)", function( assert ) {
1289
1289
jQuery ( "#qunit-fixture" ) . off ( "click" ) ;
1290
1290
} ) ;
1291
1291
1292
- QUnit . test ( "Delegated events with malformed selectors (# 3071)" , function ( assert ) {
1293
- assert . expect ( 2 ) ;
1292
+ QUnit . test ( "Delegated events with malformed selectors (gh- 3071)" , function ( assert ) {
1293
+ assert . expect ( 3 ) ;
1294
1294
1295
- assert . throws ( function ( ) {
1296
- jQuery ( "#qunit-fixture " ) . on ( "click" , "div :not" , function ( ) { } ) ;
1297
- } , null , "malformed selector throws on attach" ) ;
1295
+ assert . throws ( function ( ) {
1296
+ jQuery ( "#foo " ) . on ( "click" , ":not" , function ( ) { } ) ;
1297
+ } , "malformed selector throws on attach" ) ;
1298
1298
1299
- jQuery ( "#qunit-fixture" ) . click ( ) ;
1300
- assert . ok ( true , "malformed selector does not throw on event" ) ;
1299
+ assert . throws ( function ( ) {
1300
+ jQuery ( "#foo" ) . on ( "click" , "nonexistent:not" , function ( ) { } ) ;
1301
+ } , "short-circuitable malformed selector throws on attach" ) ;
1301
1302
1302
- jQuery ( "#qunit-fixture" ) . off ( "click" ) ;
1303
+ jQuery ( "#foo > :first-child" ) . click ( ) ;
1304
+ assert . ok ( true , "malformed selector does not throw on event" ) ;
1303
1305
} ) ;
1304
1306
1305
1307
QUnit . test ( "Delegated events in forms (#10844; #11145; #8165; #11382, #11764)" , function ( assert ) {
0 commit comments