ChildNode.remove () polyfill with babel- polyfill

I use ChildNode.remove () and I described Mozilla I need a polyfill for IE. I am using webpack with babel-polyfill setting:

 "babel-polyfill": "^6.13.0",
 "webpack": "^2.4.1",

webpack.config.babel.js:

    entry: ['babel-polyfill', join(__dirname, path, "index.web.js") ],

My assumption was that babel-polyfill will provide me with all the usual polyfill I need - but it is not, I have a bug in Internet Explorer 11 . Is there any other configuration that I skipped?

thank

+4
source share
2 answers

babel-polyfill javascript-, , Childnode.remove() DOM, babel . , polyfill, Mozilla.

// from:https://github.com/jserz/js_piece/blob/master/DOM/ChildNode/remove()/remove().md
(function (arr) {
  arr.forEach(function (item) {
    if (item.hasOwnProperty('remove')) {
      return;
    }
    Object.defineProperty(item, 'remove', {
      configurable: true,
      enumerable: true,
      writable: true,
      value: function remove() {
        this.parentNode.removeChild(this);
      }
    });
  });
})([Element.prototype, CharacterData.prototype, DocumentType.prototype]);
+8

( ) babel- polyfill Polyfill.io.

babel-polyfill, Polyfill.io Javascript (, Array.from), , babel- polyfill, DOM (, ChildNode.remove()). , , , , .

, Polyfill.io , babel-polyfill , ( runter-runtime), babel-polyfill.

+1

Source: https://habr.com/ru/post/1676237/


All Articles