Skip to content

Instantly share code, notes, and snippets.

@kylebuch8
Created May 19, 2017 12:29
Show Gist options
  • Save kylebuch8/dbe5a704425bdc7e76e478e45e548d64 to your computer and use it in GitHub Desktop.
Save kylebuch8/dbe5a704425bdc7e76e478e45e548d64 to your computer and use it in GitHub Desktop.
Polymer 2.0 - Place element html in the light dom instead of creating a shadow root
<dom-module id="thing-thing">
<template>
<h1>I'm in the light dom</h1>
</template>
<script>
class ThingThing extends Polymer.Element {
_attachDom(dom) {
this.appendChild(dom);
}
}
customElements.define('thing-thing', ThingThing);
</script>
</dom-module>
<!--
instead of creating a shadow root in thing-thing, this just puts
everything in the light dom so you should see something like...
-->
<thing-thing>
<h1>I'm in the light dom</h1>
</thing-thing>
@kylebuch8
Copy link
Author

I would recommend against doing this and only use this if you are really struggling with getting styles from the document down into your components.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment