Skip to content

Instantly share code, notes, and snippets.

@rowan-m
Created August 27, 2019 09:14
Show Gist options
  • Save rowan-m/2f80b1a6ceb36acae93d3b2c51f8fbd7 to your computer and use it in GitHub Desktop.
Save rowan-m/2f80b1a6ceb36acae93d3b2c51f8fbd7 to your computer and use it in GitHub Desktop.
// connectedCallback()
if (!this._container.part) {
// create a <span>
const wrapper = document.createElement('span');
// move this element's child nodes into it
wrapper.append(...this.childNodes);
// add the classes
wrapper.classList.add('fallback');
this.classList.add('fallback');
// and add the wrapper into this element
this.append(wrapper);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment