Created
February 4, 2019 14:59
-
-
Save mvysny/be9cb729e8bc03cfaed94bf833eb0c35 to your computer and use it in GitHub Desktop.
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
<!doctype html> | |
<html> | |
<head> | |
<!-- Polyfills only needed for Firefox and Edge. --> | |
<script src="https://unpkg.com/@webcomponents/webcomponentsjs@latest/webcomponents-loader.js"></script> | |
<script src="https://code.jquery.com/jquery-2.1.2.js"></script> | |
<script src="https://code.jquery.com/jquery-2.1.1.js"></script> | |
</head> | |
<body> | |
<!-- Works only on browsers that support Javascript modules like | |
Chrome, Safari, Firefox 60, Edge 17 --> | |
<script type="module"> | |
import {LitElement, html, css} from 'https://unpkg.com/lit-element/lit-element.js?module'; | |
class MyElement extends LitElement { | |
static get properties() { | |
return { | |
mood: {type: String} | |
} | |
} | |
static get styles() { | |
return css`.mood { color: green; }`; | |
} | |
render() { | |
return html`Web Components are <span class="mood">${this.mood}</span>!`; | |
} | |
} | |
customElements.define('my-element', MyElement); | |
</script> | |
<my-element mood="great"></my-element> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment