#6911 closed bug (fixed)
.live('click',handler) should not fire on disabled button in IE
Reported by: | yoursunny | Owned by: | danheberden |
---|---|---|---|
Priority: | high | Milestone: | 1.5.1 |
Component: | event | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
Take the following snippet:
<div id="a"> <input type="button" disabled="disabled" id="b1" value="button1"> </div>
$(':button','#a').live('click',function(){ });
The live click event does not fire in Firefox 3.6, but fires in IE8 on Win7. Since the button is disabled, I think the correct implementation should not fire live click event on #b1.
Attachments (1)
Change History (28)
Changed 13 years ago by
Attachment: | jquery-live-disabled.htm added |
---|
comment:1 Changed 13 years ago by
Milestone: | 1.4.3 → 1.next |
---|---|
Priority: | → high |
Status: | new → open |
Version: | 1.4.2 → 1.4.3 |
comment:2 Changed 13 years ago by
Milestone: | 1.4.4 → 1.4.5 |
---|
Retargeting due to severity of regressions in 1.4.3.
comment:3 Changed 13 years ago by
Milestone: | 1.4.5 → 1.4.4 |
---|
Retargeting for 1.4.4 as per John’s request.
comment:4 Changed 13 years ago by
Owner: | set to danheberden |
---|---|
Status: | open → assigned |
comment:5 Changed 13 years ago by
Submitted pull request to disable events on disabled items: http://github.com/jquery/jquery/pull/76
comment:6 Changed 13 years ago by
Heh, guess it helps to log in before doing that :p Pull req: http://github.com/jquery/jquery/pull/76
comment:8 Changed 13 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
comment:9 Changed 13 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:12 Changed 13 years ago by
Status: | reopened → assigned |
---|
comment:14 Changed 12 years ago by
Milestone: | 1.4.5 → 1.5 |
---|
Move fixed tickets to appropriate milestone
comment:15 Changed 12 years ago by
Is this correct? It seems to me the fix should be to check currentTarget, not target.
Also, it's not limited to IE - it can be reproduced on Chrome 9.0.597.45. See http://forum.jquery.com/topic/live-inconsistency-with-disabled-buttons.
comment:17 Changed 12 years ago by
danheberden: thanks. I think this might really be a separate bug, which is half fixed by your commit.
It's possible to receive events for a disabled <button> element as well as <input type="button">:
http://jsfiddle.net/Fz2F3/ (jQuery 1.4.4) http://jsfiddle.net/Fz2F3/1/ (jQuery 1.5)
IE7 fires click for all of them, passing the button as the target and currentTarget. Chrome fires only for the <button> with a child element, passing that as the target. However, currentTarget is set to the button, so changing target.disabled to currentTarget.disabled should extend the fix to include Chrome.
I didn't realise 1.5 had already been released, so I'll open a new ticket specifically for buttons on Chrome.
Mark
comment:18 Changed 12 years ago by
Milestone: | 1.5 → 1.5.1 |
---|---|
Resolution: | fixed |
Status: | closed → reopened |
Version: | 1.4.3 → 1.5 |
Well in the end it's the same root issue, i'll go a head and re-open this one. Thanks for your work!
comment:19 Changed 12 years ago by
Ahh, do you want me to delete http://bugs.jquery.com/ticket/8165?
comment:22 Changed 12 years ago by
Status: | reopened → open |
---|
comment:23 Changed 12 years ago by
Resolution: | → fixed |
---|---|
Status: | open → closed |
actually, just might got it fixed
comment:24 Changed 12 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
comment:25 Changed 12 years ago by
DaveMethvin pummeled me until i saw a way to do it - all better in https://github.com/jquery/jquery/pull/237
reproduce code