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
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
class OSUIButton extends HTMLButtonElement {…} | |
customElements.define('osui-button', OSUIButton {extends: 'button'}); |
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 CardSectioned extends Card {…} | |
customElements.define('osui-card-sectioned', CardSectioned ); |
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
class Card extends HTMLElement {} | |
customElements.define('osui-card', Card); |
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></osui-card> |
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 template = document.querySelector('template'); | |
const node = document.importNode(template.content, true); | |
document.body.appendChild(node); |
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
<template> | |
<h1>Hello world</h1> | |
</template> |