Skip to content

Instantly share code, notes, and snippets.

@tbranyen
Created May 28, 2017 22:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbranyen/57b64798a0ec02f178492f29b6cdba46 to your computer and use it in GitHub Desktop.
Save tbranyen/57b64798a0ec02f178492f29b6cdba46 to your computer and use it in GitHub Desktop.
// Allow the user to invoke the Custom Element chain.
function makeElement(tagName, props) {
const Constructor = customElements.get(tagName);
if (Constructor) {
return new Constructor(props);
}
else {
document.createElement(tagName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment