- Notifications
You must be signed in to change notification settings - Fork20.6k
Selector: Make empty attribute selectors work in IE again#4510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
+21 bytes This only fixes the issue in IE, not Edge. See the comment at#4435 (comment) for the rationale. |
We could also accept the perf hit & assign such a temporary name attribute in all browsers, at least once. Hopefully that wouldn't cause style recalculation as the final value would be the same as the initial one, worth checking. |
Uh oh!
There was an error while loading.Please reload this page.
6532f6e
toc9bb72b
ComparePR updated. I build a test case similar tohttps://jsbin.com/cocaqis/1/edit?html,js but with one iframe being available immediately in the DOM (with similar DOM contents) and another similar one being added after a few seconds. If there was no workaround, all of them failed. If I added a workaround in the main doc, all succeeded. If I added one in the first iframe, the selection in the main DOM failed & then the selection in both iframes succeeded. If I added it to the second one, it was failing until the selection happened in that second iframe, then all started suceeding. Also, if I see success, after refreshing the page (with "Always refresh from server" checked in the Network DevTools tab) I see every selection succeeding as well so the workaround even survives page refreshes. Of course, IE being IE, it's not impossible that the workaround stops working after a while but for now I think we can work on the assumption it survives long enough. If that proves not enough, we'll depend on someone submitting an issue. |
+30 bytes, BTW. |
Sizzle version of the PR:jquery/sizzle#461 |
2c81e75
toea031e8
Comparemgol commentedOct 15, 2019 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
PR updated. |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
02f1756
to4ee9ec3
CompareqSA in IE 11/Edge often (but not always) don't find elements with an emptyname attribute selector (`[name=""]`). Detect that & fall back to Sizzletraversal.Interestingly, IE 10 & older don't seem to have the issue.Fixesjquerygh-4435
Uh oh!
There was an error while loading.Please reload this page.
Summary
qSA in IE often (but not always) doesn't find elements with an empty name
attribute selector (
[name=""]
).Assigning a temporary name attribute tothe document root (& removing it afterwards) seems to resolve the issue.
EDIT: Detect that & fall back to Sizzle traversal.
Fixesgh-4435
Checklist
If needed, a docs issue/PR was created athttps://github.com/jquery/api.jquery.com