diff options
author | Felipe Sateler <fsateler@gmail.com> | 2016-05-01 18:40:20 -0300 |
---|---|---|
committer | Richard Gibson <richard.gibson@gmail.com> | 2016-05-06 22:12:20 -0400 |
commit | 7fd36ea145a11d5896de6d064b546b1c57a83f34 (patch) | |
tree | 93f66ac01b9aaa6cd0229939b2cd852a35574e8e /test | |
parent | 931f45fc387d68cfce004f786330d18f74cf03e5 (diff) | |
download | jquery-7fd36ea145a11d5896de6d064b546b1c57a83f34.tar.gz jquery-7fd36ea145a11d5896de6d064b546b1c57a83f34.zip |
Event: Evaluate delegate selectors at add time
This ensures that invalid selectors throw right away.
Fixes gh-3071
Closes gh-3097
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/event.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 236214730..6b4af04b9 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1289,6 +1289,19 @@ QUnit.test( "Delegated events in SVG (#10791; #13180)", function( assert ) { jQuery( "#qunit-fixture" ).off( "click" ); } ); +QUnit.test( "Delegated events with malformed selectors (#3071)", function( assert ) { + assert.expect( 2 ); + + assert.throws( function () { + jQuery( "#qunit-fixture" ).on( "click", "div:not", function () { } ); + }, null, "malformed selector throws on attach" ); + + jQuery( "#qunit-fixture" ).click(); + assert.ok( true, "malformed selector does not throw on event" ); + + jQuery( "#qunit-fixture" ).off( "click" ); +} ); + QUnit.test( "Delegated events in forms (#10844; #11145; #8165; #11382, #11764)", function( assert ) { assert.expect( 5 ); |