Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Merge pull request #363 from arv/fix-ie-9-inner-html
Browse files Browse the repository at this point in the history
Fix IE9 issue with innerHTML on plaintext elements
  • Loading branch information
dfreedm committed Jan 23, 2014
2 parents 0295a63 + 9727272 commit a0ba985
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/wrappers/HTMLElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@
}
}

// IE11 does not have MSIE in the user agent string.
var oldIe = /MSIE/.test(navigator.userAgent);

var OriginalHTMLElement = window.HTMLElement;

function HTMLElement(node) {
Expand All @@ -147,6 +150,17 @@
return getInnerHTML(this);
},
set innerHTML(value) {
// IE9 does not handle set innerHTML correctly on plaintextParents. It
// creates element children. For example
//
// scriptElement.innerHTML = '<a>test</a>'
//
// Creates a single HTMLAnchorElement child.
if (oldIe && plaintextParents[this.localName]) {
this.textContent = value;
return;
}

var removedNodes = snapshotNodeList(this.childNodes);

if (this.invalidateShadowRenderer())
Expand Down

0 comments on commit a0ba985

Please sign in to comment.