-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Why not use querySelector instead of queryFirst #65
Comments
Have a look at the code and you'll see that queryFirst is a wrapper for query that return all of the element found using querySelectorAll. I think that it's correct to use the querySelectorAll since most of the time you should manipulate all of the same objects within the page.
|
Yes thanks after I take a looked to the code I created the issue. Because: function queryFirst( selector ) {
return query( selector )[ 0 ];
} Creates the same result as And about:
I agree but in the cases where |
I agree, unless the intent is to abstract using the DOM API directly. If that's the case, it would still be more efficient to change |
To be clear, most of the advantage is to keep a common interface between |
I think that would be just change the code inside |
It's up to you, really, you're welcome to start a PR. Just bear in mind that the approach throughout this project has generally been "prototype first, code correctness eventually" 😄 , which is why you'll find tons of oddities in the code. We've been delaying refactoring up until the point where it's actually limiting us to implement something else. |
Closing for now, we can reopen if/when it becomes an issue in the plugin phase. |
…space Backspace interception for iOS.
Looking into the code I found the usage of
queryFirst
but I believequerySelector
already does this.Is there any reason to not use
querySelector
instead? I would like to create a PR with the changes if required.Thank you.
The text was updated successfully, but these errors were encountered: