From c3c229b0a5fb77987a8fe8baf02166755d3bf4e8 Mon Sep 17 00:00:00 2001 From: Manolo Carrasco Date: Fri, 23 Sep 2011 14:16:03 +0000 Subject: [PATCH] fix clone node issue --- .../src/main/java/com/google/gwt/query/client/GQuery.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java index b871db88..80af90b7 100644 --- a/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java +++ b/gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java @@ -1770,7 +1770,6 @@ public class GQuery implements Lazy { } private GQuery domManip(GQuery g, DomMan type, Element... elms) { - int size = g.size(); JsNodeArray newNodes = JsNodeArray.create(); if (elms.length == 0) { elms = elements; @@ -1780,14 +1779,14 @@ public class GQuery implements Lazy { if (e.getNodeType() == Node.DOCUMENT_NODE) { e = e.cast().getBody(); } - for (int j = 0; j < size; j++) { + for (int j = 0, size = g.size(); j < size; j++) { // Widget w = getAssociatedWidget(g.get(j)); // GqUi.detachWidget(w); Node n = g.get(j); // If an element selected is inserted elsewhere, it will be moved into the target (not cloned). // If there is more than one target element, however, cloned copies of the inserted element will be created for each target after the first - if (size > 1 || i > 0) { + if (i > 0) { n = n.cloneNode(true); } switch (type) { -- 2.39.5