diff options
author | Manolo Carrasco <manolo@apache.org> | 2012-10-12 19:40:44 +0200 |
---|---|---|
committer | Manolo Carrasco <manolo@apache.org> | 2012-10-12 19:40:44 +0200 |
commit | c661cbf469dd9f1d798a72b6e69a8f938442d7ca (patch) | |
tree | 38b543321346b404ba6023379b8ce749cc452567 /gwtquery-core | |
parent | 03416384193306569b447544e6446b4a469a7e77 (diff) | |
download | gwtquery-c661cbf469dd9f1d798a72b6e69a8f938442d7ca.tar.gz gwtquery-c661cbf469dd9f1d798a72b6e69a8f938442d7ca.zip |
Remove temporary parent node when creating dom elements from html string
Diffstat (limited to 'gwtquery-core')
-rw-r--r-- | gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java | 11 |
1 files changed, 9 insertions, 2 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 831e9b61..3b5a539d 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 @@ -399,6 +399,9 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { // TODO: fix IE link tag serialization
// TODO: fix IE <script> tag
+ // TODO: add fixes for IE TBODY issue
+
+ // We use a temporary element to wrap the elements
Element div = doc.createDivElement();
div.setInnerHTML(wrapper.preWrap + elem.trim() + wrapper.postWrap);
Node n = div;
@@ -406,8 +409,12 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> { while (depth-- != 0) {
n = n.getLastChild();
}
- // TODO: add fixes for IE TBODY issue
- return $((NodeList<Element>) n.getChildNodes().cast());
+
+ return
+ // return all nodes added to the wrapper
+ $(n.getChildNodes())
+ // detach nodes from their temporary parent
+ .remove();
}
/**
|