
if (typeof Element !== 'undefined') {
  // Polyfill for array remove
  (() => {
    function polyfill (item) {
      if ('remove' in item) {
        return
      }
      Object.defineProperty(item, 'remove', {
        configurable: true,
        enumerable: true,
        writable: true,
        value: function remove () {
          if (this.parentNode !== undefined) { this.parentNode.removeChild(this) }
        }
      })
    }

    if (typeof window.Element !== 'undefined') { polyfill(window.Element.prototype) }
    if (typeof window.CharacterData !== 'undefined') { polyfill(window.CharacterData.prototype) }
    if (typeof window.DocumentType !== 'undefined') { polyfill(window.DocumentType.prototype) }
  })()
}

// simple polyfill for Array.findIndex
if (!Array.prototype.findIndex) {
  // eslint-disable-next-line no-extend-native
  Object.defineProperty(Array.prototype, 'findIndex', {
    value: function (predicate) {
      for (let i = 0; i < this.length; i++) {
        const element = this[i]
        if (predicate.call(this, element, i, this)) {
          return i
        }
      }
      return -1
    },
    configurable: true,
    writable: true
  })
}

// Polyfill for Array.find
if (!Array.prototype.find) {
  // eslint-disable-next-line no-extend-native
  Object.defineProperty(Array.prototype, 'find', {
    value: function (predicate) {
      const i = this.findIndex(predicate)
      return this[i]
    },
    configurable: true,
    writable: true
  })
}

// Polyfill for String.trim
if (!String.prototype.trim) {
  // eslint-disable-next-line no-extend-native
  String.prototype.trim = function () {
    return this.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '')
  }
}

@@ -101,24 +101,67 @@
 ll (item) %7B%0A
+      if (typeof item !== 'undefined') %7B%0A  
       if ('r
@@ -174,24 +174,26 @@
  in item) %7B%0A
+  
         retu
@@ -197,26 +197,30 @@
 eturn%0A      
-%7D%0A
+  %7D%0A  
       Object
@@ -257,24 +257,26 @@
 , %7B%0A        
+ 
+ 
 configurable
@@ -291,16 +291,18 @@
         
+  
 enumerab
@@ -315,24 +315,26 @@
 ue,%0A        
+ 
+ 
 writable: tr
@@ -329,32 +329,34 @@
 writable: true,%0A
+  
         value: f
@@ -371,24 +371,26 @@
 remove () %7B%0A
+  
           if
@@ -464,26 +464,30 @@
 ) %7D%0A        
-%7D%0A
+  %7D%0A  
       %7D)%0A   
@@ -483,16 +483,24 @@
      %7D)%0A
+      %7D%0A
     %7D%0A%0A 

verify object prototype before define 'remove' property in it (#1385)