Skip to content

Commit c8181b9

Browse files
authored
Merge 106dc0b into dc3eba2
2 parents dc3eba2 + 106dc0b commit c8181b9

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

innerText/setter-tests.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,11 @@ testHTML("<div><br>", "abc", "abc", "Existing <br> deleted");
2525
testHTML("<div>", "", "", "Assigning the empty string");
2626
testHTML("<div>", null, "", "Assigning null");
2727
testHTML("<div>", undefined, "undefined", "Assigning undefined");
28+
29+
// Setting innerText on these should not throw
30+
["area", "base", "basefont", "bgsound", "br", "col", "embed", "frame", "hr",
31+
"image", "img", "input", "keygen", "link", "menuitem", "meta", "param",
32+
"source", "track", "wbr", "colgroup", "frameset", "head", "html", "table",
33+
"tbody", "tfoot", "thead", "tr"].forEach(function(tag) {
34+
testText(document.createElement(tag), "abc", "abc", "innerText on <" + tag + "> element");
35+
});

innerText/setter.html

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,13 @@
55
<div id="container"></div>
66
<script>
77
function setupTest(context, plain) {
8-
container.innerHTML = context;
8+
// context is either a string or an element node
9+
if (typeof context === "string") {
10+
container.innerHTML = context;
11+
} else {
12+
container.innerHTML = "";
13+
container.appendChild(context);
14+
}
915
var e = container.firstChild;
1016
while (e && e.nodeType != Node.ELEMENT_NODE) {
1117
e = e.nextSibling;

0 commit comments

Comments
 (0)