-
Notifications
You must be signed in to change notification settings - Fork 20.5k
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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. |
6532f6e to
c9bb72b
Compare
|
PR updated. I build a test case similar to https://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 to
ea031e8
Compare
|
PR updated. |
02f1756 to
4ee9ec3
Compare
qSA in IE 11/Edge often (but not always) don't find elements with an empty name attribute selector (`[name=""]`). Detect that & fall back to Sizzle traversal. Interestingly, IE 10 & older don't seem to have the issue. Fixes jquerygh-4435
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.
Fixes gh-4435
Checklist
If needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com