-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
Bug of find element with empty attribute in v3.4 #4435
Comments
We should look into the behavior change, but it's not surprising as Edge and IE often fill in undefined attributes with empty string, making them difficult to differentiate. |
Probably related to #3550 |
I added an update at #3550. @hirofumii can you check if your issue still exists with https://code.jquery.com/jquery-git.js instead of your current copy of jQuery? |
I checked this against jquery-git in IE11 on browserstack and it's still failing. |
Ok, I figured out the difference. It seems it's due to a recent optimization in Sizzle where we tried to avoid manipulating the DOM when it wasn't necessary. Turns out you get the right result if you add the ID of the context to the selector: https://jsbin.com/vasufuv/1/edit?html,js,console,output |
Thanks, @mgol. I tested it in my environment just in case, but unfortunately the problem was not solved. |
@hirofumii See my comment above. It is indeed Sizzle. |
@timmywil Oh, sorry! I saw the comment and intended to add 😄, but not... |
EDIT: This wasn't a PR for this issue. |
@timmywil Oh, that's weird that an ID would help here. Given that observation, should we just revert the optimization (both in Sizzle & jQuery Also, from what I see the patch at jquery/sizzle@71fe25c is not entirely correct as it skips the temporary ID for sibling selectors, pushing a selector with a leading combinator to qSA directly which crashes and goes to a slower Sizzle route. |
I though about all this, my conclusions:
See a PR implementing that last suggestion: #4510 Let's talk it through at the next meeting. |
It looks like applying the workaround once fixes it even for other frames and the workaround even survives browser refreshes. Therefore, we'll just apply it in all browsers unconditionally; hopefully that will resolve the issue. Two PRs are available:
|
qSA in IE 11/Edge often (but not always) don'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. Interestingly, IE 10 & older don't seem to have the issue. Fixes jquerygh-4435
qSA in IE 11/Edge often (but not always) don'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. Interestingly, IE 10 & older don't seem to have the issue. Fixes jquery/jquery#4435
qSA in IE 11/Edge often (but not always) don'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. Interestingly, IE 10 & older don't seem to have the issue. Fixes jquery/jquery#4435
qSA in IE 11/Edge often (but not always) don'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. Interestingly, IE 10 & older don't seem to have the issue. Fixes jquery/jquery#4435
Sizzle PR landed: jquery/sizzle#461. Reopening as we still need to update Sizzle for this to be fixed in jQuery. |
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
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
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
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
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
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
The fix for jQuery 4.0 landed in 05184cc. Re-opening as we still need to update Sizzle for jQuery 3.5.0. |
Fixes jquerygh-4424 Fixes jquerygh-4435 Fixes jquerygh-4441 Fixes jquerygh-4453
Sizzle update merged in #4641. The issue is now fixed both on |
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
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. Ref jquerygh-4435 Ref jquerygh-4510 Ref jquery/sizzle#461
Description
Hi.
After updating jQuery to 3.4, I encountered strange behavior on Edge and IE11.
Finding elements with empty attributes was successful in v3.3.
But, v3.4 and later will fail on Edge and IE11.
Link to test case
https://jsbin.com/jitatiduqi/1/edit?html,css,js,output
If this is a bug, I'm glad if a fix is considered.
Thanks.
The text was updated successfully, but these errors were encountered: