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

filter on <dom-repeat> doesn't use JS filter syntax as specified in documentation #3094

Closed
David-Mulder opened this issue Nov 26, 2015 · 3 comments

Comments

@David-Mulder
Copy link

The documentation states

A function that can be used to filter items out of the view. This property should either be provided as a string, indicating a method name on the element's host, or else be an actual function. The function should match the sort function passed to Array.filter. Using a filter function has no effect on the underlying items array.

First of all it should probably state callback function instead of sort function. Secondly and more importantly the calls here and here miss the index and array arguments which one would expect on Array.filter's callback function:

Function to test each element of the array. Invoked with arguments (element, index, array). Return true to keep the element, false otherwise.

Per https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter

And yes, this is extremely useful, as Polymer doesn't support myArray.0 bindings right now, so anytime you need to do that you have to actually use a dom-repeat just to have the binding system work '-_- (and yes, I am aware of array-selector but that would be even more confusing)

@kevinpschaaf
Copy link
Member

Closing per Polymer/old-docs-site#1381; website documentation is updated. See discussion on #2187 for background.

@ktiedt
Copy link
Contributor

ktiedt commented Jul 22, 2016

When this was closed... the actual documentation in the code was not fixed.

https://github.com/Polymer/polymer/blob/master/src/lib/template/dom-repeat.html#L161-L168

ktiedt added a commit to ktiedt/polymer that referenced this issue Jul 22, 2016
Update the documentation in the actual dom-repeat element.
ktiedt added a commit to ktiedt/polymer that referenced this issue Jul 22, 2016
Update the documentation in the actual dom-repeat element.
kevinpschaaf added a commit that referenced this issue Jul 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants