Created
May 19, 2017 12:29
-
-
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.