Skip to content

Commit 3dff1b8

Browse files
committed
one more test
1 parent 20c573e commit 3dff1b8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

src/test/java/org/htmlunit/javascript/host/dom/RangeTest.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,31 @@ public void createContextualFragment2() throws Exception {
147147
loadPageVerifyTitle2(html);
148148
}
149149

150+
/**
151+
* @throws Exception if the test fails
152+
*/
153+
@Test
154+
@Alerts("<div id=\"myDiv2\"></div>hello:<div id=\"myDiv3\"></div>")
155+
public void createContextualStrangeCode() throws Exception {
156+
final String html = DOCTYPE_HTML
157+
+ "<html><head>\n"
158+
+ "<script>\n"
159+
+ LOG_TITLE_FUNCTION
160+
+ " function test() {\n"
161+
+ " var element = document.getElementById('myDiv2');\n"
162+
+ " var range = element.ownerDocument.createRange();\n"
163+
+ " range.setStartAfter(element);\n"
164+
+ " var fragment = range.createContextualFragment('hello:<world');\n"
165+
+ " element.parentNode.insertBefore(fragment, element.nextSibling);\n"
166+
+ " log(element.parentNode.innerHTML);\n"
167+
+ " }\n"
168+
+ "</script></head><body onload='test()'>\n"
169+
+ " <div id='myDiv'><div id='myDiv2'></div><div id='myDiv3'></div></div>\n"
170+
+ "</body></html>";
171+
172+
loadPageVerifyTitle2(html);
173+
}
174+
150175
/**
151176
* @throws Exception if the test fails
152177
*/

0 commit comments

Comments
 (0)