Side navigation
#8128 closed bug (duplicate)
Opened February 01, 2011 05:13PM UTC
Closed February 01, 2011 08:39PM UTC
Last modified February 01, 2011 08:42PM UTC
IE7 - possible selector error
Reported by: | scottjehl | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | 1.next |
Component: | selector | Version: | 1.5 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
I'm not sure if this is a bug or not, but in jQuery Mobile we use the following selector to find any focused element on the page and blur it (which in turn hides the keyboard):
$( window.document.activeElement ).add(':focus').blur();
The :focus selector throws an exception in both IE7 and Windows Mobile. Changing it to something more specific, like "input:focus, textarea:focus" avoids the problem, but I figured I should post this in case it's actually a bug.
Hey Scott, this isn't a bug.
:focus
isn't a selector jQuery core supports officially.It's a valid CSS3 selector and thus
$(":focus")
(and the like) happen to "just work" in all browsers which supportquerySelectorAll
. But this selector will fail in any browser which does not have qSA (as this test case shows by disabling qSA).So you probably should check if qSA is available before doing
.add(":focus")
.Anyway, maybe it's just a coincidence but Paul Irish recently proposed adding
:focus
as supported selector. So please follow the ticket mentioned below for progress on this issue.