We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
由于良好的兼容性,在自己目前的业务代码中,到处都会用到 document.querySelector() 以及 document.querySelectorAll() 这两个方法。但是总是要手写这两个方法的话就太长了、太花时间了。那么怎样能够简化输入呢?
document.querySelector()
document.querySelectorAll()
用关键字 js short for document.querySelector Google,第一个链接是 Stack Overflow 上的回答,就是自己想要的结果。
js short for document.querySelector
bind()
var $ = document.querySelector.bind(document); var $$ = document.querySelectorAll.bind(document);
上面这两行代码,是兼容性最好的版本,直接拿来用即可。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
需求描述
由于良好的兼容性,在自己目前的业务代码中,到处都会用到
document.querySelector()
以及document.querySelectorAll()
这两个方法。但是总是要手写这两个方法的话就太长了、太花时间了。那么怎样能够简化输入呢?方案调研
用关键字
js short for document.querySelector
Google,第一个链接是 Stack Overflow 上的回答,就是自己想要的结果。参考资料
bind()
方法,以及这种用法的注意事项。关键代码
上面这两行代码,是兼容性最好的版本,直接拿来用即可。
The text was updated successfully, but these errors were encountered: