style-sharing-across-shadow.html 457 B

1234567891011121314151617181920212223
  1. <!doctype html>
  2. <style>
  3. div { display: contents }
  4. </style>
  5. <div></div>
  6. <div></div>
  7. <script>
  8. let divs = document.querySelectorAll('div');
  9. divs[0].attachShadow({mode: 'open'}).innerHTML = `
  10. <style>
  11. * { color: green; }
  12. </style>
  13. <span>Should be green</span>
  14. `;
  15. divs[1].attachShadow({mode: 'open'}).innerHTML = `
  16. <style>
  17. * { color: initial; }
  18. [foo] { }
  19. </style>
  20. <span>Should not be green</span>
  21. `;
  22. </script>