html 浏览器等兼容问题——持续更新
dom对象 element.firstChild.nextElenentSibling; //谷歌可以获取nextElenentSibling,ie不兼容,修改:nextSibling,都兼容
- ie浏览器不支持es6语法规范的而解决方案:进入babel,利用babel对代码进行自动改造:
链接地址:https://babel.docschina.org/repl
示例:ie 不支持 for of 遍历的写法:
-
我写的在ie不兼容的代码
for(let i of arrayi){
} -
babel 返回:
“use strict”;
var _iteratorNormalCompletion = true;
var _didIteratorError = false;
var _iteratorError = undefined;
try {
for (var _iterator = arrayiSymbol.iterator, _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
var i = _step.value;
}
} catch (err) {
_didIteratorError = true;
_iteratorError = err;
} finally {
try {
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
} finally {
if (_didIteratorError) {
throw _iteratorError;
}
}
}
界面操作示例截图: