| James Graham | c81317a | 2016-05-09 20:46:52 | [diff] [blame] | 1 | <!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> |
| 9 | function testIsChild(p, c) { |
| 10 | assert_equals(p.firstChild, c); |
| 11 | assert_equals(c.parentNode, p); |
| 12 | } |
| 13 | test(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> |