Edit on
<button onclick="onClickHandler()">Hello World</button>
var host = document.querySelector('button');
var root = host.createShadowRoot();
root.textContent = 'Lorem Ipsum';

// Outputs Hello World
function onClickHandler() {
    alert( host.textContent );
}
Rerun