Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged
mgol merged 1 commit intojquery:masterfrommgol:attr-empty
Nov 18, 2019

Conversation

mgol
Copy link
Member

@mgolmgol commentedOct 13, 2019
edited
Loading

Summary

qSA in IE often (but not always) doesn't find elements with an empty name
attribute selector ([name=""]).Assigning a temporary name attribute to
the document root (& removing it afterwards) seems to resolve the issue.

EDIT: Detect that & fall back to Sizzle traversal.

Fixesgh-4435

Checklist

@mgol
Copy link
MemberAuthor

+21 bytes

This only fixes the issue in IE, not Edge. See the comment at#4435 (comment) for the rationale.

@mgol
Copy link
MemberAuthor

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.

@mgolmgolforce-pushed theattr-empty branch 4 times, most recently from6532f6e toc9bb72bCompareOctober 14, 2019 18:14
@mgol
Copy link
MemberAuthor

PR 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.

@mgol
Copy link
MemberAuthor

+30 bytes, BTW.

@mgol
Copy link
MemberAuthor

Sizzle version of the PR:jquery/sizzle#461

@mgolmgolforce-pushed theattr-empty branch 3 times, most recently from2c81e75 toea031e8CompareOctober 15, 2019 19:06
@mgol
Copy link
MemberAuthor

mgol commentedOct 15, 2019
edited
Loading

PR updated.[name=''] now falls back to Sizzle traversal & both IE 11 & Edge 15-18 pass all tests.+49 +50 bytes.

@mgolmgolforce-pushed theattr-empty branch 4 times, most recently from02f1756 to4ee9ec3CompareOctober 22, 2019 23:00
qSA 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
@mgolmgol merged commit05184cc intojquery:masterNov 18, 2019
@mgolmgol deleted the attr-empty branchNovember 18, 2019 21:11
@locklockbot locked asresolvedand limited conversation to collaboratorsMay 20, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@gibson042gibson042gibson042 approved these changes

@timmywiltimmywiltimmywil approved these changes

Assignees
No one assigned
Labels
Milestone
4.0.0
Development

Successfully merging this pull request may close these issues.

Bug of find element with empty attribute in v3.4
3 participants
@mgol@timmywil@gibson042

[8]ページ先頭

©2009-2025 Movatter.jp