Closed
Conversation
Member
Author
|
Updated for smaller file size. Using |
Member
Author
|
Replaced by #113. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
document.getElementsByNamedoesn't behave as predictably as we'd all like it to. Sometimes, in quirks mode, IE limits the results to "form controls" (INPUT,SELECT,TEXTAREA, and other elements identified in HTML4 as ascribing meaning to thenameattribute). When that is the case,jQuery("[name=*]")(which is optimized withgetElementsByName) behaves even less predictably... it will include elements of any tag name if and only if there are no "form controls" matching the selector. I made a test case that showcases this absolutely bizarre IE behavior.What's more,
document.querySelectorAlldoes work as expected, so the quirky behavior is also dependent upon its definition and the presence or absence of pseudo-selectors. And although workaround selectors are easy to write, it's also easy to get tripped up by non-obvious method implementations:$current.has('[name=*]').The bottom line is that we can only promise consistency by abandoning
document.getElementsByNameoptimization of name selectors when it excludes elements from consideration. This pull request does precisely that.