Reputation: 101
I would like to make a context menu element that automatically adds a contextmenu
listener to it's parent element (so it can be expanded when the parent is right-clicked). I managed to do it by looking up this.parentNode
when the element sits in a regular DOM hierarchy. However, when inside a shadow DOM, this.parentNode
points to #document-fragment
and there doesn't seem to be a way to pierce through that barrier. Is there something I am missing here?
Upvotes: 2
Views: 880
Reputation: 11027
there doesn't seem to be a way to pierce through that barrier
In Polymer, there is a host
property on the Shadow DOM document-fragment that points to the owning element.
Upvotes: 2