JSFiddle - React, Tailwind, and code Playground

by stopsatgreen

HTML

<button is="my-button" onclick="event.target.myMethod()">Hello world</button>
<x-plop>Bums</x-plop>

JavaScript

var proto = Object.create(HTMLButtonElement.prototype);
proto.myMethod = function() {
    alert(this.textContent);
};
myButton = document.register('my-button', {prototype: proto});

var XPlopProto = Object.create(HTMLElement.prototype);
XPlopProto.readyCallback = function() {
    this.textContent = "I'm HERE!!!";
}
var XPlop = document.register('x-plop', {prototype: XPlopProto});