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
osui-card:not(:defined) { | |
/* Pre-style, give layout, replicate card's eventual styles, etc. */ | |
opacity: 0; | |
transition: opacity 0.3s ease-in-out; | |
} |
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
const header = document.createElement('header'); | |
const shadowRoot = header.attachShadow({mode: 'open'}); | |
shadowRoot.innerHTML = '<h1>Hello Shadow DOM</h1>'; |
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
class Card extends HTMLElement { | |
constructor() { | |
super(); | |
const shadowRoot = this.attachShadow({mode: 'open'}); | |
shadowRoot.innerHTML = ` | |
<style>.card { … }</style> | |
<div class="card">…</div>`; |
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
<script type="module"> | |
let moduleDocument = import.meta.document; | |
class HTML5Element extends HTMLElement { | |
constructor() { | |
super(); | |
} | |
} | |
export { HTML5Element }; |
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
<html> | |
<head> | |
<script type="module"> | |
import { HTML5Element } from "./html5Element.html"; | |
window.customElements.define("my-html5-element", HTML5Element); | |
</script> | |
</head> | |
<body> | |
<my-html5-element></my-html5-element> |
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
<html> | |
<head> | |
<script type="module"> | |
import { HTML5Element } from "./html5Element.html"; | |
window.customElements.define("my-html5-element", HTML5Element); | |
</script> | |
</head> | |
<body> | |
<my-html5-element></my-html5-element> |
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
<div class="section-title" part="title"></div> |
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
osui-section::part(title) { | |
border-bottom: 1px solid red; | |
} |
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
class Card extends HTMLElement { | |
// A getter/setter for a disabled property. | |
get disabled() { | |
return this.hasAttribute('disabled'); | |
} | |
constructor() { | |
// Always call super() first! This is specific to Custom Element and required by the spec. | |
super(); |
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
<div class="card card-sectioned flex-directon-column"> | |
<div class="card-image"></div> | |
<div class="card-sectioned-top flex-direction-column"> | |
<div class="card-title"></div> | |
<div class="card-content"></div> | |
<div class="card-bottom"></div> | |
</div> | |
</div> |