If we define a custom element like:
class PrintOutput extends HTMLElement { constructor() { super(); const templateNode = document.getElementById(this.getAttribute('from')); if (templateNode) evalFromTo(templateNode, this); } } customElements.define('print-output', PrintOutput);
<div id=counterout></div> <script> evalFromTo(document.querySelector('#counterapp'), document.querySelector('#counterout')); </script>
<print-output from=counterapp></print-output>
If we define a custom element like:
Then instead of calling the evalFromTo() function: We could simply use the <print-output> custom element: [1]: https://developer.mozilla.org/en-US/docs/Web/Web_Components/...