| <!DOCTYPE html> |
| <html> |
| <head> |
| <script src="../../../resources/js-test-pre.js"></script> |
| </head> |
| <body> |
| <div id="console"> |
| </div> |
| <script> |
| description("This tests the innerHTML property of a shadow root."); |
| |
| if (!window.internals) |
| debug('This test runs on DRT only'); |
| |
| if (window.testRunner) { |
| testRunner.dumpAsText(); |
| |
| host = document.createElement("div"); |
| document.body.appendChild(host); |
| root = host.webkitCreateShadowRoot(); |
| |
| var div1 = document.createElement("div"); |
| div1.setAttribute("id", "div1"); |
| root.appendChild(div1); |
| |
| var div2 = document.createElement("div"); |
| div2.setAttribute("id", "div2"); |
| root.appendChild(div2); |
| |
| shouldBeFalse("'innerHTML' in internals.shadowRoot"); |
| shouldBeDefined("root.innerHTML"); |
| shouldBe("root.innerHTML", "'<div id=\"div1\"></div><div id=\"div2\"></div>'"); |
| |
| root.innerHTML = "Hello"; |
| shouldBe("root.innerHTML", "'Hello'"); |
| |
| root.innerHTML = "<p id=\"p3\">HelloWorld</p>"; |
| |
| shouldBe("root.innerHTML", "'<p id=\"p3\">HelloWorld</p>'"); |
| shouldBe("root.firstChild.nodeName", "'P'"); |
| shouldBe("root.querySelectorAll('div')", "[]"); |
| shouldBe("root.getElementById('p3').innerHTML", "'HelloWorld'"); |
| |
| } |
| var successfullyParsed = true; |
| </script> |
| <script src="../../../resources/js-test-post.js"></script> |
| </body> |
| </html> |