|
7 | 7 | <p id="para"> And</p> |
8 | 8 | <!--comment--> |
9 | 9 | </div> |
| 10 | + <div id="rootNodeComposed"></div> |
10 | 11 | </body> |
11 | 12 |
|
12 | 13 | <script src="../testing.js"></script> |
|
36 | 37 | testing.expectEqual('HTMLDocument', content.getRootNode().__proto__.constructor.name); |
37 | 38 | </script> |
38 | 39 |
|
| 40 | +<script id=getRootNodeComposed> |
| 41 | + const testContainer = $('#rootNodeComposed'); |
| 42 | + const shadowHost = document.createElement('div'); |
| 43 | + testContainer.appendChild(shadowHost); |
| 44 | + const shadowRoot = shadowHost.attachShadow({ mode: 'open' }); |
| 45 | + const shadowChild = document.createElement('span'); |
| 46 | + shadowRoot.appendChild(shadowChild); |
| 47 | + |
| 48 | + testing.expectEqual('ShadowRoot', shadowChild.getRootNode().__proto__.constructor.name); |
| 49 | + testing.expectEqual('ShadowRoot', shadowChild.getRootNode({ composed: false }).__proto__.constructor.name); |
| 50 | + testing.expectEqual('HTMLDocument', shadowChild.getRootNode({ composed: true }).__proto__.constructor.name); |
| 51 | + testing.expectEqual('HTMLDocument', shadowHost.getRootNode().__proto__.constructor.name); |
| 52 | + |
| 53 | + const disconnected = document.createElement('div'); |
| 54 | + const disconnectedChild = document.createElement('span'); |
| 55 | + disconnected.appendChild(disconnectedChild); |
| 56 | + testing.expectEqual('HTMLDivElement', disconnectedChild.getRootNode().__proto__.constructor.name); |
| 57 | + testing.expectEqual('HTMLDivElement', disconnectedChild.getRootNode({ composed: true }).__proto__.constructor.name); |
| 58 | +</script> |
| 59 | + |
39 | 60 | <script id=firstChild> |
40 | 61 | let body_first_child = document.body.firstChild; |
41 | 62 | testing.expectEqual('div', body_first_child.localName); |
|
0 commit comments