angular-hmr
angular-hmr copied to clipboard
removeNgStyles fails on IE 11
When removeNgStyles is called on IE 11, the use of remove on the Element fails as IE 11 does not define the remove function on Element.
yeah for ie11 I need to use removeChild()
If you're working with https://github.com/AngularClass/angular-starter, you can drop this polyfill into the dev portion of polyfills to get this working: https://developer.mozilla.org/en-US/docs/Web/API/ChildNode/remove#Polyfill
// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md
((arr) => {
arr.forEach((item) => {
if (item.hasOwnProperty('remove')) {
return;
}
Object.defineProperty(item, 'remove', {
configurable: true,
enumerable: true,
writable: true,
// tslint:disable-next-line:only-arrow-functions
value: function remove() {
this.parentNode.removeChild(this);
}
});
});
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
