Commits

Christian Krebs committed ef5a52c

Implementation of Element.prototype.insertAdjacentHTML rto test in FF.

Comments (0)

Files changed (1)

src/scripts/dom.js

   }
 }
 
+if (!Element.prototype.insertAdjacentHTML)
+{
+  Element.prototype.insertAdjacentHTML = function(position, markup)
+  {
+    if (position == 'beforeend')
+    {
+      var div = this.appendChild(document.createElement('div'));
+      div.innerHTML = markup;
+      var range = document.createRange();
+      range.selectNodeContents(div);
+      this.replaceChild(range.extractContents(), div);
+      return this.firstElementChild;
+    }
+  }
+}
+
 /**
  * @fileoverview
  * Helper function prototypes related to DOM objects and the DOM