Created
November 5, 2021 18:40
-
-
Save nolanlawson/cbc40307e15f99be6e084ac0fffb59be to your computer and use it in GitHub Desktop.
Bare ::part(foo) selector
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
<!doctype html> | |
<html lang=en> | |
<head> | |
<title>Bare ::part(foo) selector</title> | |
</head> | |
<body> | |
<h1>Bare ::part(foo) selector</h1> | |
<custom-component></custom-component> | |
<body> | |
<script type=module> | |
class CustomComponent extends HTMLElement { | |
constructor() { | |
super() | |
this.attachShadow({ mode: 'open' }).innerHTML = ` | |
<style> | |
::part(foo) { | |
color: blue; | |
} | |
</style> | |
<span part="foo">I should NOT be blue</span> | |
` | |
} | |
} | |
customElements.define('custom-component', CustomComponent) | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment