diff options
-rw-r--r-- | src/event.js | 2 | ||||
-rw-r--r-- | test/unit/event.js | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/event.js b/src/event.js index 33610fd6f..8e17273f9 100644 --- a/src/event.js +++ b/src/event.js @@ -384,7 +384,7 @@ jQuery.event = { // Pregenerate a single jQuery object for reuse with .is() jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; + jqcur.context = this; for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { diff --git a/test/unit/event.js b/test/unit/event.js index a6ee455fb..07da83260 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -2333,6 +2333,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"); + + markup + .find("#u1") + .on( "click", "li:first", function() { + ok( this.id === "f1" , "first li under #u1 was clicked" ); + }) + .find("#f1").click().end() + .end() + .remove(); +}); + test("stopPropagation() stops directly-bound events on delegated target", function() { expect(1); |