<!DOCTYPE html> | |
<template><style> | |
:host { | |
display: block; | |
background: blue !important; | |
} | |
</style><content></content></template> | |
<script> | |
(function() { | |
var d = document.currentScript.ownerDocument; | |
var proto = Object.create(HTMLElement.prototype); | |
proto.createdCallback = function() { | |
this.attachShadow({mode: 'open'}).appendChild(this.ownerDocument.importNode(d.querySelector("template").content)); | |
}; | |
window.MyElement = document.registerElement('my-blue', { prototype: proto }); | |
})(); | |
</script> | |