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) {
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>";