| <!DOCTYPE html> |
| <script src='../resources/testharness.js'></script> |
| <script src='../resources/testharnessreport.js'></script> |
| <style> |
| div { color: red; } |
| </style> |
| <div id='host'></div> |
| <div id='dummy'></div> |
| <script> |
| 'use strict'; |
| |
| var root = host.createShadowRoot(); |
| root.innerHTML = '<style>:host(#host) { color: green; }</style>'; |
| |
| test(() => { |
| assert_equals(window.getComputedStyle(host).color, 'rgb(0, 128, 0)'); |
| // Trigger "V1" shadow cascading order. |
| let doc_v1 = document.implementation.createHTMLDocument('v1 document'); |
| let div_v1 = doc_v1.createElement('div'); |
| doc_v1.body.appendChild(div_v1); |
| div_v1.attachShadow({mode: 'open'}); |
| dummy.appendChild(div_v1); |
| assert_equals(window.getComputedStyle(host).color, 'rgb(255, 0, 0)'); |
| }, 'Upgrading V0 to V1 should cause style recalculation.'); |
| </script> |