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