ES6下的webcomponents-lite在ie11和ie10下无法工作
webcomponents-lite with ES6 doesn't work in IE 11 and 10
我们使用的是ES6语法的WebComponents。
WebComponents polyfill WebComponents -lite.js(不包括ShadowDOM) 在IE 11中不工作,而WebComponents .js(包括ShadowDOM)工作得很好。对于我们的项目用例,我们想使用'custom-elements'而不使用ShadowDOM。
如果我们使用webcomponents-lite.js - SCRIPT5022: Exception thrown and not caught.
是否有其他解决方法?
编辑:我试图在IE中运行的代码与webcomponents-lite.js
HTML: <super-button></super-button>
JS (ES6格式):
class SuperBtn extends HTMLElement {
constructor() {
super();
}
createdCallback() {
this.innerHTML = "Invoke Ultron!";
this.addEventListener('click', () => alert(this.textContent + ' has been clicked'));
}
}
document.registerElement("super-button", SuperBtn);
可以,您可以使用原始的prototype
符号声明自定义元素v1。
这适用于来自Web Reflection:
的另一个多边形。var CEo = function ()
{
console.log( "created" )
return Reflect.construct( HTMLElement, [], CEo )
}
CEo.prototype = Object.create( HTMLElement.prototype )
CEo.prototype.constructor = CEo
CEo.prototype.connectedCallback = function ()
{
console.log( "connected" )
this.innerHTML = "Hello v1"
}
customElements.define( "object-v1", CEo )
注意:你需要使用一个像Babel一样的填充来获得Reflect.construct
方法。
相关文章:
- Console.debug在ie10中不工作
- 与wavesurfer.js成角度;我不在IE10工作
- MSAnimationStart事件没有'我不在IE10上工作
- 使用jquery在dom中移动嵌入的youtube iframe会导致全屏无法在Windows8 IE10中工作
- 是否有人获得了在IE10中工作的javascript msProtocols属性
- IE10视频标签突然停止工作
- forEach在IE10上不能在Server 2008上工作,但在其他任何地方都可以在IE10中工作
- JavaScript中的ValidatorValidate方法在ie10中不工作
- 显示/隐藏内容在IE10及以下版本无法工作.Div不可点击
- 不显眼的javascript MVC3验证在IE9中不工作,在IE10, safari中工作
- 如何使ImpressJS在IE10上工作
- 指针事件和不透明度在IE10中不工作
- JavaScript不能在ie10上工作
- bxSlider在IE10中不工作
- JQuery -脚本工作在所有除了IE10
- onblur和link元素在Chrome中不能正常工作-在ie10中没有问题
- removeEventListener在IE10中不工作,在Chrome中工作
- Bookmarklet无法在IE10中工作/打开
- Javascript窗口.打开器不能在ie10中工作
- Javascript函数在ie10中不能正常工作