OLD | NEW |
(Empty) | |
| 1 <!doctype html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/js-test.js"></script> |
| 5 </head> |
| 6 <body> |
| 7 <object id="o1" name="obj1"><div></div></object> |
| 8 <object id="o2" name="obj2"><param name="n"><div></div></param></object> |
| 9 <script> |
| 10 var obj; |
| 11 var host; |
| 12 var shadowRoot; |
| 13 var child; |
| 14 |
| 15 function testAncestorObjectDivShadow() { |
| 16 debug("Shadow DOM inside an <object> and a <div>"); |
| 17 obj = document.getElementById("o1"); |
| 18 host = obj.querySelector("div"); |
| 19 shadowRoot = host.createShadowRoot(); |
| 20 |
| 21 child = document.createElement("object"); |
| 22 child.name = "obj1-child1"; |
| 23 shadowRoot.appendChild(child); |
| 24 |
| 25 // Inner <object> not visible for two reasons: |
| 26 // <object> ancestor + shadow root in-between. |
| 27 shouldBeFalse("child.name in document"); |
| 28 shouldBeFalse("child.name in window"); |
| 29 |
| 30 // Should be able to see 'obj'..even with a descendant <object>, but hidden
by shadow. |
| 31 shouldBeTrue("obj.name in document"); |
| 32 } |
| 33 |
| 34 function testSiblingObjectShadow() { |
| 35 debug("Shadow DOM attached to <div> with an <object> sibling (ne
xt)."); |
| 36 var div = document.createElement("div"); |
| 37 document.body.appendChild(div); |
| 38 var div2 = document.createElement("div"); |
| 39 div.appendChild(div2); |
| 40 obj = document.createElement("object"); |
| 41 obj.name = "obj3"; |
| 42 div2.appendChild(obj); |
| 43 shadowRoot = div2.createShadowRoot(); |
| 44 |
| 45 child = document.createElement("embed"); |
| 46 child.name = "embed1"; |
| 47 shadowRoot.appendChild(child); |
| 48 |
| 49 // <embed> not visible for two reasons: |
| 50 // <object> ancestor + shadow root in-between. |
| 51 shouldBeFalse("child.name in document"); |
| 52 shouldBeFalse("child.name in window"); |
| 53 |
| 54 // Should be able to see 'obj'..even though it has an <embed> descendant. |
| 55 shouldBeTrue("obj.name in document"); |
| 56 } |
| 57 |
| 58 function testSiblingShadowObject() { |
| 59 debug("Shadow DOM attached to <div> with an <object> sibling (pr
evious)."); |
| 60 var div = document.createElement("div"); |
| 61 document.body.appendChild(div); |
| 62 var div2 = document.createElement("div"); |
| 63 div.appendChild(div2); |
| 64 obj = document.createElement("object"); |
| 65 obj.name = "obj4"; |
| 66 div2.appendChild(obj); |
| 67 shadowRoot = div2.createShadowRoot(); |
| 68 |
| 69 child = document.createElement("embed"); |
| 70 child.name = "embed1"; |
| 71 shadowRoot.appendChild(child); |
| 72 |
| 73 // <embed> not visible for two reasons: |
| 74 // <object> ancestor + shadow root in-between. |
| 75 shouldBeFalse("child.name in document"); |
| 76 shouldBeFalse("child.name in window"); |
| 77 |
| 78 // Should be able to see 'obj'..even though it has an <embed> descendant. |
| 79 shouldBeTrue("obj.name in document"); |
| 80 } |
| 81 |
| 82 function testAncestorObjectParamShadow() { |
| 83 debug("Shadow DOM attached to <div> inside a <param> inside an &
lt;object>."); |
| 84 obj = document.getElementById("o2"); |
| 85 |
| 86 // Should be able to see 'obj' initially. |
| 87 shouldBeTrue("obj.name in document"); |
| 88 |
| 89 host = obj.querySelector("div"); |
| 90 shadowRoot = host.createShadowRoot(); |
| 91 |
| 92 child = document.createElement("embed"); |
| 93 child.name = "embed1"; |
| 94 shadowRoot.appendChild(child); |
| 95 |
| 96 // <embed> not visible for two reasons: |
| 97 // <object> ancestor + shadow root in-between. |
| 98 shouldBeFalse("child.name in document"); |
| 99 shouldBeFalse("child.name in window"); |
| 100 |
| 101 // Should still be able to see 'obj' |
| 102 shouldBeTrue("obj.name in document"); |
| 103 } |
| 104 |
| 105 testAncestorObjectDivShadow(); |
| 106 testSiblingObjectShadow(); |
| 107 testSiblingShadowObject(); |
| 108 testAncestorObjectParamShadow(); |
| 109 </script> |
| 110 </body> |
| 111 </html> |
| 112 |
| 113 |
OLD | NEW |