相关疑难解决方法(0)

为document.querySelectorAll创建一个简短的别名

我将运行document.querySelectorAll()很多,并且想要一个简写别名.

var queryAll = document.querySelectorAll

queryAll('body')
TypeError: Illegal invocation
Run Code Online (Sandbox Code Playgroud)

不行.鉴于:

document.querySelectorAll('body')
Run Code Online (Sandbox Code Playgroud)

仍然.如何使别名起作用?

javascript native-methods

47
推荐指数
6
解决办法
1万
查看次数

标签 统计

javascript ×1

native-methods ×1