Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x-repeat] can't bind to childNodes under Shadow DOM #1367

Closed
justinfagnani opened this issue Apr 3, 2015 · 3 comments
Closed

[x-repeat] can't bind to childNodes under Shadow DOM #1367

justinfagnani opened this issue Apr 3, 2015 · 3 comments
Labels

Comments

@justinfagnani
Copy link
Contributor

With a template like this:

<template>
  <template is="x-repeat" items="{{fooNodes}}">{{item.nodeName}}</template>
</template>

And code like this:

this.fooNodes = Polymer.dom(foo).childNodes;

An exception is thrown under Shadow DOM, but not Shady DOM:

Uncaught TypeError: this.collection.observe is not a function

@justinfagnani
Copy link
Contributor Author

I presume this is because Polymer.dom().childNodes is an Array under Shady DOM, but a NodeList under Shadow DOM.

If possible, x-repeat should be made to handle NodeLists, if not Polymer.dom() should tag its arrays somehow so that they also cause an exception in x-repeat.

@sorvell
Copy link
Contributor

sorvell commented Apr 3, 2015

Currently x-repeat requires an array. We should probably make Polymer.dom().childNodes an actual array for consistency, but it does cover up a potentially confusing issue wrt x-repeat.

@justinfagnani
Copy link
Contributor Author

Making childNodes an Array would be nice for consistency...

sorvell added a commit that referenced this issue Apr 9, 2015
@sorvell sorvell closed this as completed May 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants