【发布时间】:2020-09-27 23:20:33
【问题描述】:
jQuery.type() is deprecated in jQuery 3.3 and above. 在重构使用此 API 的旧代码时,我应该使用什么来代替 jQuery.type()?
例如,我的页面所依赖的插件之一使用 $.type() API,如下所示。
if ($.type(button) !== 'object') {
throw new Error('button with key "' + key + '" must be an object');
}
我想用未弃用的东西替换它。
【问题讨论】:
-
好吧,只是去掉变量名,可能是
!button || !button.tagName || button.tagName !== 'BUTTON' -
j11y.io/jquery/#v=1.11.2&fn=jQuery.type 你也可以看看源代码,看看他们在做什么
标签: jquery