From 0a0aae8de0ed9dfb7ded85d090ffdf8dffec58b9 Mon Sep 17 00:00:00 2001 From: lordfuoco Date: Thu, 1 Dec 2016 16:29:43 +0100 Subject: [PATCH] Added local dom lenght check --- etools-repeatable-field-set.html | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etools-repeatable-field-set.html b/etools-repeatable-field-set.html index ad0f10e..d5e58cd 100644 --- a/etools-repeatable-field-set.html +++ b/etools-repeatable-field-set.html @@ -377,6 +377,12 @@ this._itemCounter = this._isCopy; this._isCopy = -1; } + //this is to keep the counter in sync with the local dom, + // it can happen that they go out of sync. this prevent two element on the same row + var siblings = Polymer.dom(self.root).querySelectorAll('.item-content'); + if(siblings.length !== self._itemCounter) { + self._itemCounter = siblings.length - 1; + } children.forEach(function(child) { var currentItem = self.$$('#item-' + self._itemCounter); if(currentItem) {