geoloeg / dom-repeat-n Goto Github PK
View Code? Open in Web Editor NEW[Polymer 1.x] A template element that repeat n times its content.
License: MIT License
[Polymer 1.x] A template element that repeat n times its content.
License: MIT License
The 'dom-repeat-n' template causes a TypeError when reducing the count by a large amount (e.g. from 4 to 1).
polymer-mini.html:2046 Uncaught TypeError: Cannot read property '_children' of undefined(โฆ)_detachInstance @ dom-repeat-n.html:172
The problem is that method '_countChanged' iterates over the 'instances' array while at the same time removing values from it. This fails when removing more than half of the entries as the length of the array is then lower than the used index.
I managed to locally fix this problem by reversing the order, in which the iteration is performed. I replace the following line:
for (i=newCount; i<limit; i++) {
with
for (i=limit-1; i>newCount-1; i--) {
Seems that _render
is sometimes being called with _instances
not being of the same length as this.count
, which causes the inst
variable inside the loop to be undefined.
Either patching render to loop over _instances
instead, or patching being called while _instances
is out of parity with count
should do the trick.
Hello! ๐
I find dom-repeat-n
very useful, and I have implemented it in several of my projects. I'm now porting those projects to Polymer 2, and would like to continue using dom-repeat-n
. I see that work has begun on upgrading this element to Polymer 2, but it seems that more work still needs to be done. Is there a list of
remaining tasks I could help out with?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.