Reputation: 36765
Is it possible to traverse the DOM subtree when I am using a Polymer element custom-element
like
<polymer-element name="custom-element" attributes="something">
<template>
</template>
<script>
// access ul and li from the actual DOM here.
</script>
</polymer-element>
<body>
<custom-element something="foo">
<ul>
<li>Bar</li>
<li>Hello</li>
</ul>
</custom-element>
</body>
I want to be able to parameterize my Polymer element using the markup that's wrapped by it.
Upvotes: 0
Views: 331
Reputation: 36765
Actually, this.children
allows access to them.
<polymer-element name="custom-element" attributes="something">
<template>
</template>
<script>
Polymer({
created: function() {
console.log(this.children);
}
});
</script>
</polymer-element>
Upvotes: 1