Johnnie Walker
Johnnie Walker

Reputation: 65

Access to light DOM when using webcomponents.js (Shadow DOM polyfill)

I'm trying to access the light DOM when using the webcomponents.js polyfill but it does not seem to work. (works fine in native Shadow DOM/Chrome)

Here is a reduced test of what I’m trying to do:

sample: http://jsbin.com/wudakapujo/1/ code: http://jsbin.com/wudakapujo/1/edit

Any hints/pointers regarding how I could access the Light DOM data when using the Shadow DOM polyfill would be greatly appreciated

Thanks!

Upvotes: 1

Views: 259

Answers (2)

Flying Emu
Flying Emu

Reputation: 430

Try adding <content></content> to your template, or <content select="span"></content> to just get the span tag.

<template>
  <h1>SHADOW DOM CONTENT</h1>
  <content select="span"></content>
</template>

Upvotes: 0

lazieburd
lazieburd

Reputation: 2796

Did you try looking in

this.content.getDistributedNodes() 

See https://www.polymer-project.org/resources/faq.html#accessContentDOM

Upvotes: 0

Related Questions