diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2012-06-26 21:38:30 -0400 |
---|---|---|
committer | Dave Methvin <dave.methvin@gmail.com> | 2012-06-27 11:58:16 -0400 |
commit | 8a01c9201abb3a5311d5b0019b0322de89df6374 (patch) | |
tree | aff5567159c9144d1cc06058e0581cdcdf7c6ac5 /test/unit | |
parent | 94e744aec9d25bb64a3cb72c3b81dd95e94d3955 (diff) | |
download | jquery-8a01c9201abb3a5311d5b0019b0322de89df6374.tar.gz jquery-8a01c9201abb3a5311d5b0019b0322de89df6374.zip |
Fix #11382. #11764. Only prevent click events on disabled elements.
We don't want a disabled link/button to register delegated clicks, but we do want events like mouseover or custom events.
This is a compromise, there is no perfect solution. Well, the browsers could be consistent about direct vs. delegated events but *that's* not gonna happen.
Diffstat (limited to 'test/unit')
-rw-r--r-- | test/unit/event.js | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/test/unit/event.js b/test/unit/event.js index 07da83260..479509ffb 100644 --- a/test/unit/event.js +++ b/test/unit/event.js @@ -1298,8 +1298,8 @@ test("Delegated events in SVG (#10791)", function() { svg.remove(); }); -test("Delegated events in forms (#10844; #11145; #8165)", function() { - expect(3); +test("Delegated events in forms (#10844; #11145; #8165; #xxxxx)", function() { + expect(5); // Alias names like "id" cause havoc var form = jQuery( @@ -1334,11 +1334,20 @@ test("Delegated events in forms (#10844; #11145; #8165)", function() { form .append( '<button id="nestyDisabledBtn"><span>Zing</span></button>' ) .on( "click", "#nestyDisabledBtn", function() { - ok( true, "enabled/disabled button with nesty elements" ); + ok( true, "click on enabled/disabled button with nesty elements" ); + }) + .on( "mouseover", "#nestyDisabledBtn", function() { + ok( true, "mouse on enabled/disabled button with nesty elements" ); }) - .find( "span" ).trigger( "click" ).end() // yep + .find( "span" ) + .trigger( "click" ) // yep + .trigger( "mouseover" ) // yep + .end() .find( "#nestyDisabledBtn" ).prop( "disabled", true ).end() - .find( "span" ).trigger( "click" ).end() // nope + .find( "span" ) + .trigger( "click" ) // nope + .trigger( "mouseover" ) // yep + .end() .off( "click" ); form.remove(); |