diff options
author | Richard Gibson <richard.gibson@gmail.com> | 2012-07-23 12:48:29 -0400 |
---|---|---|
committer | Timmy Willison <timmywillisn@gmail.com> | 2012-07-23 12:49:45 -0400 |
commit | e761e0c6e0561093ff1e52d0cba6ace04daa8798 (patch) | |
tree | bee27d3b055ea31ca8bdb5a0aed8dad1149dac33 /test/unit/event.js | |
parent | a08a18b80adc403dc2914ee6b1ca8752aeddef30 (diff) | |
download | jquery-e761e0c6e0561093ff1e52d0cba6ace04daa8798.tar.gz jquery-e761e0c6e0561093ff1e52d0cba6ace04daa8798.zip |
Support event delegation with relative selectors. Fixes #10762. Closes gh-860.
Diffstat (limited to 'test/unit/event.js')
-rw-r--r-- | test/unit/event.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 502649a90..dacb03355 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2342,17 +2342,20 @@ test("jQuery.off using dispatched jQuery.Event", function() { .remove(); }); -test( "delegated event with delegateTarget-relative selector (#)", function() { - expect(1); - var markup = jQuery( '<ul><li><ul id="u1"><li id="f1"></li></ul></li>' ).appendTo("body"); +test( "delegated event with delegateTarget-relative selector", function() { + expect(2); + var markup = jQuery( '<ul><li><a id="a0"></a><ul id="ul0"><li><a id="a0_0"></a></li><li><a id="a0_1"></a></li></ul></li></ul>' ).appendTo("body"); markup - .find("#u1") - .on( "click", "li:first", function() { - ok( this.id === "f1" , "first li under #u1 was clicked" ); + .on( "click", ">li>a", function() { + ok( this.id === "a0", "child li was clicked" ); + }) + .find("#ul0") + .on( "click", "li:first>a", function() { + ok( this.id === "a0_0" , "first li under #u10 was clicked" ); }) - .find("#f1").click().end() .end() + .find("a").click().end() .remove(); }); |