Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <script src="../resources/js-test.js"></script> | 2 <!DOCTYPE html> |
| 3 <script src='../resources/testharness.js'></script> | |
| 4 <script src='../resources/testharnessreport.js'></script> | |
| 5 <script src='resources/shadow-dom.js'></script> | |
| 6 <style> | |
| 7 #host { | |
| 8 color: red; | |
| 9 } | |
| 10 </style> | |
| 3 <div id="host"> | 11 <div id="host"> |
| 4 <div slot="s1">This text should be green</div> | 12 <template data-mode="open"> |
| 13 <style> | |
| 14 div { | |
| 15 color: green; | |
| 16 } | |
| 17 div.p1 { | |
| 18 color: blue; | |
| 19 } | |
| 20 </style> | |
| 21 <div> | |
| 22 <slot name="s1"></slot> | |
| 23 </div> | |
| 24 </template> | |
| 25 <span id="span0" slot="unassigned"></span> | |
|
hayato
2016/08/25 08:15:56
I have removed confusing <div>s from the light tre
| |
| 26 <span id="span1" slot="s1"></span> | |
| 5 </div> | 27 </div> |
| 6 <script> | 28 <script> |
| 7 description("A changed inherited property on a slot parent should propagate down to slotted elements."); | 29 test(() => { |
| 30 convertTemplatesToShadowRootsWithin(host); | |
| 8 | 31 |
| 9 var root = host.attachShadow({mode:"open"}); | 32 assert_equals(getComputedStyle(span0).color, 'rgb(0, 0, 0)', |
| 10 root.innerHTML = '<style>.p1 { color: green }</style><div id="p1"><slot name ="s1"></slot></div>'; | 33 'An element which is not assigned to any slot should not inherit a style from the parent.'); |
| 11 var p1 = root.querySelector("#p1"); | 34 assert_equals(getComputedStyle(host.shadowRoot.querySelector('slot')).color, ' rgb(0, 0, 0)', |
| 12 var s1 = host.querySelector("[slot]"); | 35 'A slot should not inherit a style from the parent because Blink does not support "slots in the flat tree".'); |
| 13 shouldBeEqualToString("getComputedStyle(s1).color", "rgb(0, 0, 0)"); | 36 |
| 14 p1.className = "p1"; | 37 assert_equals(getComputedStyle(span1).color, 'rgb(0, 128, 0)', |
| 15 shouldBeEqualToString("getComputedStyle(s1).color", "rgb(0, 128, 0)"); | 38 'An element which is assigned to a slot should inherit a style f rom the slot.'); |
| 39 host.shadowRoot.querySelector('div').className = 'p1'; | |
| 40 assert_equals(getComputedStyle(span1).color, 'rgb(0, 0, 255)', | |
| 41 'The style change should propagate down to a slotted element.'); | |
| 42 }, 'CSS inheritance tests for assigned nodes, not-assigned nodes, and slots'); | |
| 16 </script> | 43 </script> |
| OLD | NEW |