this.register({ prototype: { readyCallback: function() { this.textContent = '[x-foo registered (click me)]'; this.addEventListener('click', function() { alert('Hi' + (this.id ? ' from "' + this.id + '"' : '')); }); } } }); setTimeout(function() { document.body.appendChild(document.createElement('x-foo')); }, 0);