aboutsummaryrefslogtreecommitdiffstats
path: root/gwtquery-core
diff options
context:
space:
mode:
Diffstat (limited to 'gwtquery-core')
-rw-r--r--gwtquery-core/src/main/java/com/google/gwt/query/client/GQuery.java3
-rw-r--r--gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java9
2 files changed, 10 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 870e886d..16b10b92 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
@@ -424,9 +424,8 @@ public class GQuery implements Lazy<GQuery, LazyGQuery> {
protected static GQuery cleanHtmlString(String elem, Document doc) {
String tag = tagNameRegex.exec(elem).get(1);
-
if (tag == null) {
- throw new RuntimeException("HTML snippet doesn't contain any tag");
+ return $(doc.createTextNode(elem));
}
if (wrapperMap == null) {
diff --git a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java
index f4081011..1180f5cc 100644
--- a/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java
+++ b/gwtquery-core/src/test/java/com/google/gwt/query/client/GQueryCoreTestGwt.java
@@ -475,6 +475,15 @@ public class GQueryCoreTestGwt extends GWTTestCase {
assertEquals(1, g2.size());
assertEquals(expected, g2.toString());
}
+
+ public void test_issue128() {
+ GQuery g = $(e).html("<span>a</span><span>b</span><span>c</span>");
+ assertEquals(g.text(), "abc");
+ $("span", e).after(" ");
+ assertEquals(g.text(), "a b c ");
+ $("span", e).after("-");
+ assertEquals(g.text(), "a- b- c- ");
+ }
public void testAppendTo() {
String txt = "<h2>Greetings</h2><div class='container'><div class='inner'>Hello</div><div class='inner'>Goodbye</div></div>";