-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
shahrul
committed
Oct 18, 2024
1 parent
195685d
commit b1f7b0c
Showing
6 changed files
with
117 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
return <!doctype html> | ||
<html> | ||
<head> | ||
<style> | ||
button { | ||
background-color: red; | ||
display: block; | ||
margin-top: 8px; | ||
} | ||
|
||
example-component::part(native) { | ||
background-color: pink; | ||
} | ||
</style> | ||
</head> | ||
<body> | ||
<example-component></example-component> | ||
<button>Button in Light DOM</button> | ||
<script> | ||
// Use custom elements API v1 to register a new HTML tag and define its JS behavior | ||
// using an ES6 class. Every instance of <fancy-tab> will have this same prototype. | ||
customElements.define('example-component', class extends HTMLElement { | ||
constructor() { | ||
super(); // always call super() first in the constructor. | ||
|
||
// Attach a shadow root to <fancy-tabs>. | ||
const shadowRoot = this.attachShadow({mode: 'open'}); | ||
shadowRoot.innerHTML = ` | ||
<style> | ||
div { | ||
height: 150px; | ||
width: 150px; | ||
border: solid 2px; | ||
} | ||
</style> | ||
|
||
<div part="native"></div> | ||
<button>Button in Shadow DOM</button> | ||
`; | ||
} | ||
}); | ||
</script> | ||
</body> | ||
</html> |
This file contains 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
This file contains 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