blob: 32c921d235d85720fc2fa44ee02b07b0bf72d0ce [file] [log] [blame]
James Grahamc81317a2016-05-09 20:46:521<!DOCTYPE html>
2<title>innerHTML in HTML</title>
3<link rel="author" title="Ms2ger" href="mailto:ms2ger@gmail.com">
4<link rel="help" href="https://w3c.github.io/DOM-Parsing/#widl-Element-innerHTML">
5<script src="/resources/testharness.js"></script>
6<script src="/resources/testharnessreport.js"></script>
7<div id="log"></div>
8<script>
9function testIsChild(p, c) {
10 assert_equals(p.firstChild, c);
11 assert_equals(c.parentNode, p);
12}
13test(function() {
14 var p = document.createElement('p');
15 var b = p.appendChild(document.createElement('b'));
16 var t = b.appendChild(document.createTextNode("foo"));
17 testIsChild(p, b);
18 testIsChild(b, t);
19 assert_equals(t.data, "foo");
20 p.innerHTML = "";
21 testIsChild(b, t);
22 assert_equals(t.data, "foo");
23}, "innerHTML should leave the removed children alone.")
24</script>