OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <script src="../../../resources/testharness.js"></script> | 2 <script src="../../../resources/testharness.js"></script> |
3 <script src="../../../resources/testharnessreport.js"></script> | 3 <script src="../../../resources/testharnessreport.js"></script> |
4 <script src="resources/shadow-dom.js"></script> | 4 <script src="resources/shadow-dom.js"></script> |
5 <div id="targets"> | 5 <div id="targets"> |
6 <div id="T0"> | 6 <div id="T0"> |
7 <div id="normal-target">Normal</div> | 7 <div id="normal-target">Normal</div> |
8 </div> | 8 </div> |
9 | 9 |
10 <div id="T1"> | 10 <div id="T1"> |
(...skipping 13 matching lines...) Expand all Loading... |
24 <script> | 24 <script> |
25 convertTemplatesToShadowRootsWithin(targets); | 25 convertTemplatesToShadowRootsWithin(targets); |
26 | 26 |
27 testSurroundContents("Normal", "normal-target", T0); | 27 testSurroundContents("Normal", "normal-target", T0); |
28 testSurroundContents("Shadow", "T1/target", T1); | 28 testSurroundContents("Shadow", "T1/target", T1); |
29 testSurroundContents("Multi-level shadow", "T2/H/target", T2); | 29 testSurroundContents("Multi-level shadow", "T2/H/target", T2); |
30 testSurroundContents("<details>", "details-target", T3); | 30 testSurroundContents("<details>", "details-target", T3); |
31 | 31 |
32 function testSurroundContents(description, targetPath, newParent) { | 32 function testSurroundContents(description, targetPath, newParent) { |
33 test(function () { | 33 test(function () { |
34 var target = getNodeInTreeOfTrees(targetPath); | 34 var target = getNodeInComposedTree(targetPath); |
35 var range = document.createRange(); | 35 var range = document.createRange(); |
36 range.selectNode(target); | 36 range.selectNode(target); |
37 assert_throws("HierarchyRequestError", function () { | 37 assert_throws("HierarchyRequestError", function () { |
38 range.surroundContents(newParent); | 38 range.surroundContents(newParent); |
39 }); | 39 }); |
40 var targetAfter = getNodeInTreeOfTrees(targetPath); | 40 var targetAfter = getNodeInComposedTree(targetPath); |
41 assert_equals(targetAfter, target, "DOM should not change after Hierarch
yRequestError"); | 41 assert_equals(targetAfter, target, "DOM should not change after Hierarch
yRequestError"); |
42 }, description); | 42 }, description); |
43 } | 43 } |
44 | 44 |
45 if (window.testRunner) | 45 if (window.testRunner) |
46 targets.style.display = "none"; | 46 targets.style.display = "none"; |
47 </script> | 47 </script> |
OLD | NEW |