| OLD | NEW |
| 1 <!doctype html> | 1 <!doctype html> |
| 2 <html> | 2 <html> |
| 3 <head> | 3 <head> |
| 4 <style> | 4 <style> |
| 5 span { | 5 span { |
| 6 text-align: top; | 6 text-align: top; |
| 7 } | 7 } |
| 8 </style> | 8 </style> |
| 9 <script> | 9 <script> |
| 10 function testChildTextOfShadowRoot() { | 10 function testChildTextOfShadowRoot() { |
| 11 var host = document.getElementById("host"); | 11 var host = document.getElementById("host"); |
| 12 var shadowRoot = host.createShadowRoot(); | 12 var shadowRoot = host.createShadowRoot(); |
| 13 var span = document.createElement('span') | 13 var span = document.createElement('span') |
| 14 span.textContent = "foo"; | 14 span.textContent = "foo"; |
| 15 shadowRoot.appendChild(span); | 15 shadowRoot.appendChild(span); |
| 16 shadowRoot.appendChild(document.createTextNode("bar")); | 16 shadowRoot.appendChild(document.createTextNode("bar")); |
| 17 document.body.offsetLeft; | 17 document.body.offsetLeft; |
| 18 host.style.fontSize = '5em'; | 18 host.style.fontSize = '5em'; |
| 19 } | 19 } |
| 20 | 20 |
| 21 function testChildTextOfShadowRootWithResetStyleInheritance() { | |
| 22 var host = document.getElementById("hostResetStyleInheritance"); | |
| 23 var shadowRoot = host.createShadowRoot(); | |
| 24 var span = document.createElement('span') | |
| 25 span.textContent = "foo"; | |
| 26 shadowRoot.appendChild(span); | |
| 27 shadowRoot.appendChild(document.createTextNode("bar")); | |
| 28 shadowRoot.resetStyleInheritance = true; | |
| 29 document.body.offsetLeft; | |
| 30 host.style.fontSize = '6em'; | |
| 31 } | |
| 32 | |
| 33 function testDistributedText() { | 21 function testDistributedText() { |
| 34 var host = document.getElementById("hostWithDistribution"); | 22 var host = document.getElementById("hostWithDistribution"); |
| 35 var shadowRoot = host.createShadowRoot(); | 23 var shadowRoot = host.createShadowRoot(); |
| 36 shadowRoot.innerHTML = "<span id='span1'><content></content></span>" | 24 shadowRoot.innerHTML = "<span id='span1'><content></content></span>" |
| 37 document.body.offsetLeft; | 25 document.body.offsetLeft; |
| 38 shadowRoot.getElementById("span1").style.fontSize = '5em'; | 26 shadowRoot.getElementById("span1").style.fontSize = '5em'; |
| 39 } | 27 } |
| 40 | 28 |
| 41 function testDistributedTextWithResetStyleInheritance() { | |
| 42 var host = document.getElementById("hostResetStyleInheritanceWithDistributio
n"); | |
| 43 var shadowRoot = host.createShadowRoot(); | |
| 44 shadowRoot.innerHTML = "<span id='span2'><content id='content'></content></s
pan>" | |
| 45 shadowRoot.getElementById("content").resetStyleInheritance = true; | |
| 46 document.body.offsetLeft; | |
| 47 shadowRoot.getElementById("span2").style.fontSize = '6em'; | |
| 48 } | |
| 49 | |
| 50 function runTests() { | 29 function runTests() { |
| 51 testChildTextOfShadowRoot(); | 30 testChildTextOfShadowRoot(); |
| 52 testChildTextOfShadowRootWithResetStyleInheritance(); | |
| 53 testDistributedText(); | 31 testDistributedText(); |
| 54 testDistributedTextWithResetStyleInheritance(); | |
| 55 } | 32 } |
| 56 </script> | 33 </script> |
| 57 </head> | 34 </head> |
| 58 <body onload="runTests()"> | 35 <body onload="runTests()"> |
| 59 <!-- [bug 101116] Text nodes in shadow roots don't inherit style properly --> | 36 <!-- [bug 101116] Text nodes in shadow roots don't inherit style properly --> |
| 60 <!-- https://bugs.webkit.org/show_bug.cgi?id=101116 --> | 37 <!-- https://bugs.webkit.org/show_bug.cgi?id=101116 --> |
| 61 <div id="host"></div> | 38 <div id="host"></div> |
| 62 <div id="hostResetStyleInheritance"></div> | |
| 63 <div id="hostWithDistribution">Foo<span>Bar</span></div> | 39 <div id="hostWithDistribution">Foo<span>Bar</span></div> |
| 64 <div id="hostResetStyleInheritanceWithDistribution">Foo<span>Bar</span></div> | |
| 65 </body> | 40 </body> |
| 66 </html> | 41 </html> |
| OLD | NEW |