From 0771a9ab578be7222c391886a1799a5d663518c3 Mon Sep 17 00:00:00 2001 From: fleck Date: Wed, 9 May 2018 11:04:07 -0400 Subject: [PATCH] Fix HTMLSelectElement.remove in IE 11 Need to support IE 11 (this may also apply to earlier versions) and found out this polyfill doesn't work on HTMLSelectElement as it doesn't have the correct prototype chain. --- src/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/index.js b/src/index.js index 0fefc8f..53479bf 100644 --- a/src/index.js +++ b/src/index.js @@ -5,6 +5,10 @@ function polyfill() { this.parentElement.removeChild(this); } + if (Object.getPrototypeOf(Object.getPrototypeOf(HTMLSelectElement)) === null) { + HTMLSelectElement.prototype.remove = Element.prototype.remove; + } + NodeList.prototype.remove = HTMLCollection.prototype.remove = function() { for(var i = this.length - 1; i >= 0; i--) { if(this[i] && this[i].parentElement) {