Side navigation
#12492 closed bug (fixed)
Opened September 09, 2012 01:52PM UTC
Closed September 11, 2012 06:50PM UTC
In textarea focus event handler, $(this).is(':focus') == false in Chrome & Safari
Reported by: | paulcalcraft@gmail.com | Owned by: | mikesherov |
---|---|---|---|
Priority: | low | Milestone: | 1.8.2 |
Component: | selector | Version: | 1.8.0 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
jsFiddle here: http://jsfiddle.net/hJwKC/4/
All browsers report 'true,true', except Chrome and Safari which both report 'false,true'. The same is the case for <input> tags.
I'm not sure what the expected behaviour is - whether an element should only report as focused after the focus handler has completed, but the cross browser inconsistency led me to believe it could be a bug. I realise it could also be a webkit bug (or feature).
Attachments (0)
Change History (6)
Changed September 09, 2012 02:10PM UTC by comment:1
resolution: | → wontfix |
---|---|
status: | new → closed |
Changed September 09, 2012 02:52PM UTC by comment:2
Just to follow up even further, the API page on :focus seems to be aware of the bug and uses a setTimeout to achieve consistency: http://api.jquery.com/focus-selector/
Changed September 09, 2012 04:25PM UTC by comment:3
component: | unfiled → selector |
---|---|
milestone: | None → 1.8.2 |
priority: | undecided → low |
resolution: | wontfix |
status: | closed → reopened |
Actually, this is really easy to fix. We can just declare chrome's matchesSelector buggy for ":focus".
Changed September 09, 2012 04:25PM UTC by comment:4
owner: | → mikesherov |
---|---|
status: | reopened → assigned |
Seems like a Webkit bug to me. One workaround is to use
document.activeElement
, which is also a lot more efficient than using.is()
with a selector. For that reason I'll close this wontfix, you could file a bug with them if you want to use the selector anyway. http://jsfiddle.net/hJwKC/7/