Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created March 1, 2022 20:05
Show Gist options
  • Save nolanlawson/3417c1534640355b382e2ab0cf6b6ee7 to your computer and use it in GitHub Desktop.
Save nolanlawson/3417c1534640355b382e2ab0cf6b6ee7 to your computer and use it in GitHub Desktop.
Repro shared constructed stylesheets issue
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>CSSStyleSheet repro</title>
</head>
<body>
<h1>CSSStyleSheet repro</h1>
<script type="module">
const template = document.createElement('template');
const div = document.createElement('div')
div.attachShadow({ mode: 'open' })
template.content.appendChild(div);
const sheet = new CSSStyleSheet()
div.shadowRoot.adoptedStyleSheets = [sheet]
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment