Last active
January 24, 2020 13:06
-
-
Save jdvivar/8b44f78aa7804ddbbd54fb526709eed8 to your computer and use it in GitHub Desktop.
Add style rules inside Web Components
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// target is a web component with an open ShadowDOM | |
const target = document.querySelector(...) | |
target.shadowRoot.styleSheets[0].insertRule(` | |
selector { | |
padding: 8px; | |
} | |
`) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment