Dealing with some relics of the past in our elements' implementation,
we've hit a snag reaching into <template>s externally to retrieve
specific elements. For example, we leave a <script
id="ceci-definition"> in our elements which contains some meta data
about the element. Looks like this:
<polymer-element>
<template>
<script id="ceci-definition">{ ... }</script>
</template>
</polymer-element>
Later, we try to retrieve it using something ugly like this:
window.CustomElements.registry[elementName].prototype.element.impl.querySelector('template').content.querySelector('script#ceci-definition');
I'm
in the process of moving those definition <script>s to be direct
children of the <polymer-element> which encloses them, which makes
reaching in for that data much easier. Like this:
<polymer-element>
<script id="ceci-definition">{ ... }</script>
<template>
</template>
</polymer-element>
and...
window.CustomElements.registry[elementName].prototype.element.impl.querySelector('script#ceci-definition');
My question: is there a cleaner, Polymer way to reach into the <polymer-element> tag for something?Note: Trying not to place this meta data on the object which is passed to Polymer().