polyfill 的现代化条件加载
Modernizer conditional load of polyfill
我正在使用一个 javascript 库,它使用 Android 4.1 似乎不完全支持的 CustomEvent。所以我想我会使用 Modernizer 有条件地在浏览器中加载 CustomEvent polyfill 的地方。
- 我去了这里:https://modernizr.com/download?customevent-dontmin
- 已选择 'CustomeEvent'、
- 下载了建议的 EventListner.js polyfill,
- 按下 'Build' 并下载了自定义的 Modernizer。
- 我添加到我的index.html:
<script src="js/modernizr-custom.js"></script>
并将此添加到我的 javascript:
Modernizr.load({
测试:Modernizr.customevent,
不:'EventListener.js'
});
但是我得到一个错误:TypeError: Modernizr.load is not a function
有人可以确认我没有完全离开这里的滑雪道并且我正确使用了 modernizer 吗?我是否必须下载另一个脚本或其他东西才能获得 Modernizer.load 功能? (自从提出类似问题后,Modernizer 似乎发生了变化)。
Modernizr.load was removed from Modernizr
Modernizr.load has been deprecated in favor of using yepnope.js directly; from v3.0, yepnope.js must be included in the page in order for Modernizr.load to work: calling .load() will simply pass the arguments on to yepnope(); this will be removed fully in a future release (#1241)
我正在使用一个 javascript 库,它使用 Android 4.1 似乎不完全支持的 CustomEvent。所以我想我会使用 Modernizer 有条件地在浏览器中加载 CustomEvent polyfill 的地方。
- 我去了这里:https://modernizr.com/download?customevent-dontmin
- 已选择 'CustomeEvent'、
- 下载了建议的 EventListner.js polyfill,
- 按下 'Build' 并下载了自定义的 Modernizer。
- 我添加到我的index.html:
<script src="js/modernizr-custom.js"></script>
并将此添加到我的 javascript:
Modernizr.load({ 测试:Modernizr.customevent, 不:'EventListener.js' });
但是我得到一个错误:TypeError: Modernizr.load is not a function
有人可以确认我没有完全离开这里的滑雪道并且我正确使用了 modernizer 吗?我是否必须下载另一个脚本或其他东西才能获得 Modernizer.load 功能? (自从提出类似问题后,Modernizer 似乎发生了变化)。
Modernizr.load was removed from Modernizr
Modernizr.load has been deprecated in favor of using yepnope.js directly; from v3.0, yepnope.js must be included in the page in order for Modernizr.load to work: calling .load() will simply pass the arguments on to yepnope(); this will be removed fully in a future release (#1241)