angular-hmr icon indicating copy to clipboard operation
angular-hmr copied to clipboard

removeNgStyles fails on IE 11

Open ghost opened this issue 8 years ago • 2 comments

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.

ghost avatar Dec 06 '16 14:12 ghost

yeah for ie11 I need to use removeChild()

PatrickJS avatar Dec 06 '16 18:12 PatrickJS

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]);

image

admosity avatar May 23 '17 18:05 admosity