What is the correct way to implement internal linking in Polymer 2.0 (linking within the same page)? I cannot seem to get access to my components that are buried within ShadowDoms, so the traditional way of using <a href="#my_section">link to top</a>
and <a name="my_section"></a>
and <a id="my_section"></a>
does not work.
I have also tried the solutions here to no avail:
- How to query elements within shadow DOM from outside in Dart?
- Is it possible to access Shadow DOM elements through the parent document?
- Using querySelector to find nested elements inside a Polymer template returns null
The following code that I've tried all return null, even when I add an id to my component:
document.querySelector('#my_section'); //null
this.$.my_section; //null
this.root.querySelector('#my_section'); //null
this.shadowRoot.querySelector('#my_section'); //null
Perhaps there is a way to accomplish this using <app-route>
?
I'm quite new to Polymer so any advice would be appreciated. Thanks in advance.