[prev in list] [next in list] [prev in thread] [next in thread] 

List:       htmlunit-develop
Subject:    Re: [HtmlUnit] SVN: [8716] trunk/htmlunit/src
From:       Ahmed Ashour <asashour () yahoo ! com>
Date:       2013-10-31 6:36:47
Message-ID: 1383201407.98629.YahooMailNeo () web140702 ! mail ! bf1 ! yahoo ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi Ronald,

> > +    @WebBrowser(value = FF, minVersion = 8)

Just a feedback, since we are not going to support older FF, there is usually no need \
to put specific outdated values.

@WebBrowser(FF) would be fine in this case.

Yours,
Ahmed

________________________________
 From: "rbri@users.sourceforge.net" <rbri@users.sourceforge.net>
To: htmlunit-develop@lists.sourceforge.net 
Sent: Wednesday, October 30, 2013 11:18 PM
Subject: [HtmlUnit] SVN: [8716] trunk/htmlunit/src
 

Revision: 8716
          http://sourceforge.net/p/htmlunit/code/8716
Author:   rbri
Date:     2013-10-30 20:18:48 +0000 (Wed, 30 Oct 2013)
Log Message:
-----------
HTMLElement.insertAdjacentHTML() is available in FF since version 8

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java
  trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java
  trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java
  trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java


Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml    2013-10-30 19:38:15 UTC (rev 8715)
+++ trunk/htmlunit/src/changes/changes.xml    2013-10-30 20:18:48 UTC (rev 8716)
@@ -8,8 +8,11 @@

     <body>
         <release version="2.14" date="???" description="Bugfixes">
+            <action type="fix" dev="rbri">
+                JavaScript: HTMLElement.insertAdjacentHTML() is available in FF \
since version 8. +            </action>
             <action type="add" dev="rbri">
-                JavaScript: Embed now supports the width and hight property.
+                JavaScript: Embed now supports the width and height property.
             </action>
             <action type="fix" dev="rbri" issue="1551">
                 JavaScript: send the correct Referer header when changing the \
location property.

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java
 ===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java \
                2013-10-30 19:38:15 UTC (rev 8715)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java \
2013-10-30 20:18:48 UTC (rev 8716) @@ -1209,7 +1209,7 @@
      *        beforeBegin, afterBegin, beforeEnd, afterEnd
      * @param text the HTML text to insert
      */
-    @JsxFunction(@WebBrowser(IE))
+    @JsxFunction({ @WebBrowser(IE), @WebBrowser(CHROME), @WebBrowser(value = FF, \
                minVersion = 8) })
     public void insertAdjacentHTML(final String where, final String text) {
         final Object[] values = getInsertAdjacentLocation(where);
         final DomNode node = (DomNode) values[0];

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java
 ===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java \
                2013-10-30 19:38:15 UTC (rev 8715)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java \
2013-10-30 20:18:48 UTC (rev 8716) @@ -14,8 +14,6 @@
  */
package com.gargoylesoftware.htmlunit.html;

-import static com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE;
-
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
@@ -26,7 +24,6 @@
import org.junit.runner.RunWith;

import com.gargoylesoftware.htmlunit.BrowserRunner;
-import com.gargoylesoftware.htmlunit.BrowserRunner.Browsers;
import com.gargoylesoftware.htmlunit.MockWebConnection;
import com.gargoylesoftware.htmlunit.SimpleWebTestCase;
import com.gargoylesoftware.htmlunit.WebClient;
@@ -177,7 +174,6 @@
      * @exception Exception If the test fails
      */
     @Test
-    @Browsers(IE)
     public void parseFragment() throws Exception {
         final String html = "<html><head><title>foo</title>\n"
                 + "<script>\n"

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java
 ===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java \
                2013-10-30 19:38:15 UTC (rev 8715)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java \
2013-10-30 20:18:48 UTC (rev 8716) @@ -133,55 +133,7 @@
      * @throws Exception if the test fails
      */
     @Test
-    @Browsers(IE)
     @Alerts({ "outside", "1", "middle", "2", "3", "4" })
-    public void insertAdjacentHTML() throws Exception {
-        insertAdjacentHTML("beforeEnd", "afterEnd", "beforeBegin", "afterBegin");
-        insertAdjacentHTML("BeforeEnd", "AfterEnd", "BeFoReBeGiN", "afterbegin");
-    }
-
-    /**
-     * @param beforeEnd data to insert
-     * @param afterEnd data to insert
-     * @param beforeBegin data to insert
-     * @param afterBegin data to insert
-     * @throws Exception if the test fails
-     */
-    private void insertAdjacentHTML(final String beforeEnd,
-            final String afterEnd, final String beforeBegin, final String \
                afterBegin) throws Exception {
-        final String html = "<html><head><title>First</title>\n"
-            + "<script>\n"
-            + "function test() {\n"
-            + "  var oNode = document.getElementById('middle');\n"
-            + "  oNode.insertAdjacentHTML('" + beforeEnd + "', ' <span id=3>before \
                end</span> ');\n"
-            + "  oNode.insertAdjacentHTML('" + afterEnd + "', ' <span id=4>after \
                end</span> ');\n"
-            + "  oNode.insertAdjacentHTML('" + beforeBegin + "', ' <span id=1>before \
                begin</span> ');\n"
-            + "  oNode.insertAdjacentHTML('" + afterBegin + "', ' <span id=2>after \
                begin</span> ');\n"
-            + "  var coll = document.getElementsByTagName('SPAN');\n"
-            + "  for (var i=0; i<coll.length; i++) {\n"
-            + "    alert(coll[i].id);\n"
-            + "  }\n"
-            + "}\n"
-            + "</script>\n"
-            + "</head>\n"
-            + "<body onload='test()'>\n"
-            + "<span id='outside' style='color: #00ff00'>\n"
-            + "<span id='middle' style='color: #ff0000'>\n"
-            + "inside\n"
-            + "</span>\n"
-            + "</span>\n"
-            + "</body></html>";
-        final HtmlPage page = loadPageWithAlerts(html);
-        final HtmlElement elt = page.getHtmlElementById("outside");
-        assertEquals("before begin after begin inside before end after end", \
                elt.asText());
-    }
-
-    /**
-     * @throws Exception if the test fails
-     */
-    @Test
-    @Browsers(IE)
-    @Alerts({ "outside", "1", "middle", "2", "3", "4" })
     public void insertAdjacentElement() throws Exception {
         insertAdjacentElement("beforeEnd", "afterEnd", "beforeBegin", "afterBegin");
         insertAdjacentElement("BeforeEnd", "AfterEnd", "BeFoReBeGiN", "afterbegin");

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java
 ===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java \
                2013-10-30 19:38:15 UTC (rev 8715)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java \
2013-10-30 20:18:48 UTC (rev 8716) @@ -4233,4 +4233,55 @@

         loadPageWithAlerts2(html);
     }
+
+    /**
+     * @throws Exception if the test fails
+     */
+    @Test
+    @Alerts({ "outside", "1", "middle", "2", "3", "4",
+        "before begin after begin inside before end after end" })
+    public void insertAdjacentHTML() throws Exception {
+        insertAdjacentHTML("beforeEnd", "afterEnd", "beforeBegin", "afterBegin");
+        insertAdjacentHTML("BeforeEnd", "AfterEnd", "BeFoReBeGiN", "afterbegin");
+    }
+
+    /**
+     * @param beforeEnd data to insert
+     * @param afterEnd data to insert
+     * @param beforeBegin data to insert
+     * @param afterBegin data to insert
+     * @throws Exception if the test fails
+     */
+    private void insertAdjacentHTML(final String beforeEnd,
+            final String afterEnd, final String beforeBegin, final String \
afterBegin) throws Exception { +        final String html = \
"<html><head><title>First</title>\n" +            + "<script>\n"
+            + "function test() {\n"
+            + "  var oNode = document.getElementById('middle');\n"
+            + "  oNode.insertAdjacentHTML('" + beforeEnd + "', ' <span id=3>before \
end</span> ');\n" +            + "  oNode.insertAdjacentHTML('" + afterEnd + "', ' \
<span id=4>after end</span> ');\n" +            + "  oNode.insertAdjacentHTML('" + \
beforeBegin + "', ' <span id=1>before begin</span> ');\n" +            + "  \
oNode.insertAdjacentHTML('" + afterBegin + "', ' <span id=2>after begin</span> ');\n" \
+            + "  var coll = document.getElementsByTagName('SPAN');\n" +            + \
"  for (var i=0; i<coll.length; i++) {\n" +            + "    alert(coll[i].id);\n"
+            + "  }\n"
+            + "  var outside = document.getElementById('outside');\n"
+            + "  var text = outside.textContent ? outside.textContent : \
outside.innerText;\n" +            + "  text = text.replace(/(\\r\\n|\\r|\\n)/gm, \
'');\n" +            + "  text = text.replace(/(\\s{2,})/g, ' ');\n"
+            + "  text = text.replace(/^\\s+|\\s+$/g, '');\n"
+            + "  alert(text);\n"
+            + "}\n"
+            + "</script>\n"
+            + "</head>\n"
+            + "<body onload='test()'>\n"
+            + "  <span id='outside' style='color: #00ff00'>\n"
+            + "    <span id='middle' style='color: #ff0000'>\n"
+            + "      inside\n"
+            + "    </span>\n"
+            + "  </span>\n"
+            + "</body></html>";
+        loadPageWithAlerts2(html);
+    }
}


------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk
_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[Attachment #5 (text/html)]

<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, \
Helvetica Neue, Helvetica, Arial, Lucida Grande, \
sans-serif;font-size:12pt"><div><span>Hi Ronald,</span></div><div style="color: \
rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', \
Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; \
font-style: normal;"><span><br></span></div><div style="color: rgb(0, 0, 0); \
font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, \
'Lucida Grande', sans-serif; background-color: transparent; font-style: \
normal;"><span>&gt;&gt;&nbsp;</span><span style="font-size: 12pt;">+ &nbsp; \
&nbsp;@WebBrowser(value = FF, minVersion = 8)</span></div><div style="color: rgb(0, \
0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, \
Arial, 'Lucida Grande', sans-serif; background-color: transparent; font-style: \
normal;"><br></div><div style="color: rgb(0, 0,  0); font-size: 16px; font-family: \
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; \
background-color: transparent; font-style: normal;"><span>Just a feedback, since we \
are not going to support older FF, there is usually no need to put specific outdated \
values.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: \
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; \
background-color: transparent; font-style: normal;"><span><br></span></div><div \
style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica \
Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; \
font-style: normal;"><span>@WebBrowser(FF) would be fine in this \
case.</span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: \
HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; \
background-color: transparent; font-style:  normal;"><span><br></span></div><div \
style="color: rgb(0, 0, 0); font-size: 16px; font-family: HelveticaNeue, 'Helvetica \
Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: transparent; \
font-style: normal;"><span>Yours,</span></div><div style="color: rgb(0, 0, 0); \
font-size: 16px; font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, \
'Lucida Grande', sans-serif; background-color: transparent; font-style: \
normal;"><span>Ahmed</span></div>  <div style="font-family: HelveticaNeue, 'Helvetica \
Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; font-size: 12pt;"> <div \
style="font-family: HelveticaNeue, 'Helvetica Neue', Helvetica, Arial, 'Lucida \
Grande', sans-serif; font-size: 12pt;"> <div dir="ltr"> <hr size="1">  <font size="2" \
face="Arial"> <b><span style="font-weight:bold;">From:</span></b> \
"rbri@users.sourceforge.net" &lt;rbri@users.sourceforge.net&gt;<br> <b><span \
style="font-weight: bold;">To:</span></b>  htmlunit-develop@lists.sourceforge.net \
<br> <b><span style="font-weight: bold;">Sent:</span></b> Wednesday, October 30, 2013 \
11:18 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> [HtmlUnit] SVN: \
[8716] trunk/htmlunit/src<br> </font> </div> <div \
class="y_msg_container"><br>Revision: 8716<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <a \
href="http://sourceforge.net/p/htmlunit/code/8716" \
target="_blank">http://sourceforge.net/p/htmlunit/code/8716</a><br>Author:&nbsp;  \
rbri<br>Date:&nbsp; &nbsp;  2013-10-30 20:18:48 +0000 (Wed, 30 Oct 2013)<br>Log \
Message:<br>-----------<br>HTMLElement.insertAdjacentHTML() is available in FF since \
version 8<br><br>Modified Paths:<br>--------------<br>&nbsp; &nbsp; \
trunk/htmlunit/src/changes/changes.xml<br>&nbsp; &nbsp; \
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java<br>&nbsp; \
&nbsp;  trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java<br>&nbsp; \
&nbsp; trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java<br>&nbsp; \
&nbsp; trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java<br><br>Modified: \
trunk/htmlunit/src/changes/changes.xml<br>===================================================================<br>--- \
trunk/htmlunit/src/changes/changes.xml&nbsp;&nbsp;&nbsp; 2013-10-30 19:38:15 UTC (rev \
8715)<br>+++ trunk/htmlunit/src/changes/changes.xml&nbsp;&nbsp;&nbsp; 2013-10-30 \
20:18:48 UTC (rev 8716)<br>@@ -8,8 +8,11 @@<br> <br>&nbsp; &nbsp;  \
&lt;body&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp;  &lt;release version="2.14" date="???" \
description="Bugfixes"&gt;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;action \
type="fix" dev="rbri"&gt;<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
JavaScript:  HTMLElement.insertAdjacentHTML() is available in FF since version \
8.<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &lt;/action&gt;<br>&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;  &lt;action type="add" dev="rbri"&gt;<br>-&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; JavaScript: Embed now supports the width \
and hight property.<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
JavaScript: Embed now supports the width and height property.<br>&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp;  &lt;/action&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \
&lt;action type="fix" dev="rbri" issue="1551"&gt;<br>&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp;  JavaScript: send the correct Referer header when \
changing the location property.<br><br>Modified: \
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEl \
ement.java<br>===================================================================<br>---
  trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java&nbsp;&nbsp;&nbsp; \
2013-10-30 19:38:15 UTC (rev 8715)<br>+++ \
trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement.java&nbsp;&nbsp;&nbsp; \
2013-10-30 20:18:48 UTC (rev 8716)<br>@@ -1209,7 +1209,7 @@<br>&nbsp; &nbsp; &nbsp; \
*&nbsp; &nbsp; &nbsp; &nbsp; beforeBegin, afterBegin, beforeEnd, afterEnd<br>&nbsp; \
&nbsp; &nbsp; * @param text the HTML text to insert<br>&nbsp; &nbsp; &nbsp; \
*/<br>-&nbsp; &nbsp; @JsxFunction(@WebBrowser(IE))<br>+&nbsp; &nbsp; @JsxFunction({ \
@WebBrowser(IE), @WebBrowser(CHROME), @WebBrowser(value = FF, minVersion = 8) \
})<br>&nbsp; &nbsp;  public void insertAdjacentHTML(final String where, final String \
text) {<br>&nbsp; &nbsp; &nbsp; &nbsp;  final Object[] values = \
getInsertAdjacentLocation(where);<br>&nbsp; &nbsp; &nbsp; &nbsp;  final DomNode node \
= (DomNode) values[0];<br><br>Modified:  \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest \
.java<br>===================================================================<br>--- \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java&nbsp;&nbsp;&nbsp; \
2013-10-30 19:38:15 UTC (rev 8715)<br>+++ \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HTMLParserListenerTest.java&nbsp;&nbsp;&nbsp; \
2013-10-30 20:18:48 UTC (rev 8716)<br>@@ -14,8 +14,6 @@<br>&nbsp; */<br> package \
com.gargoylesoftware.htmlunit.html;<br> <br>-import static \
com.gargoylesoftware.htmlunit.BrowserRunner.Browser.IE;<br>-<br> import \
java.net.URL;<br> import java.util.ArrayList;<br> import java.util.List;<br>@@ -26,7 \
+24,6 @@<br> import org.junit.runner.RunWith;<br> <br> import \
com.gargoylesoftware.htmlunit.BrowserRunner;<br>-import \
com.gargoylesoftware.htmlunit.BrowserRunner.Browsers;<br> import \
com.gargoylesoftware.htmlunit.MockWebConnection;<br>  import \
com.gargoylesoftware.htmlunit.SimpleWebTestCase;<br> import \
com.gargoylesoftware.htmlunit.WebClient;<br>@@ -177,7 +174,6 @@<br>&nbsp; &nbsp; \
&nbsp; * @exception Exception If the test fails<br>&nbsp; &nbsp; &nbsp; */<br>&nbsp; \
&nbsp;  @Test<br>-&nbsp; &nbsp; @Browsers(IE)<br>&nbsp; &nbsp;  public void \
parseFragment() throws Exception {<br>&nbsp; &nbsp; &nbsp; &nbsp;  final String html \
= "&lt;html&gt;&lt;head&gt;&lt;title&gt;foo&lt;/title&gt;\n"<br>&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  + "&lt;script&gt;\n"<br><br>Modified: \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEl \
ement3Test.java<br>===================================================================<br>--- \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java&nbsp;&nbsp;&nbsp; \
2013-10-30 19:38:15 UTC (rev 8715)<br>+++  \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElement3Test.java&nbsp;&nbsp;&nbsp; \
2013-10-30 20:18:48 UTC (rev 8716)<br>@@ -133,55 +133,7 @@<br>&nbsp; &nbsp; &nbsp; * \
@throws Exception if the test fails<br>&nbsp; &nbsp; &nbsp; */<br>&nbsp; &nbsp;  \
@Test<br>-&nbsp; &nbsp; @Browsers(IE)<br>&nbsp; &nbsp;  @Alerts({ "outside", "1", \
"middle", "2", "3", "4" })<br>-&nbsp; &nbsp; public void insertAdjacentHTML() throws \
Exception {<br>-&nbsp; &nbsp; &nbsp; &nbsp; insertAdjacentHTML("beforeEnd", \
"afterEnd", "beforeBegin", "afterBegin");<br>-&nbsp; &nbsp; &nbsp; &nbsp; \
insertAdjacentHTML("BeforeEnd", "AfterEnd", "BeFoReBeGiN", "afterbegin");<br>-&nbsp; \
&nbsp; }<br>-<br>-&nbsp; &nbsp; /**<br>-&nbsp; &nbsp;  * @param beforeEnd data to \
insert<br>-&nbsp; &nbsp;  * @param afterEnd data to insert<br>-&nbsp; &nbsp;  * \
@param beforeBegin data to insert<br>-&nbsp; &nbsp;  * @param afterBegin data to \
insert<br>-&nbsp; &nbsp;  * @throws  Exception if the test fails<br>-&nbsp; &nbsp;  \
*/<br>-&nbsp; &nbsp; private void insertAdjacentHTML(final String \
beforeEnd,<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String afterEnd, final \
String beforeBegin, final String afterBegin) throws Exception {<br>-&nbsp; &nbsp; \
&nbsp; &nbsp; final String html = \
"&lt;html&gt;&lt;head&gt;&lt;title&gt;First&lt;/title&gt;\n"<br>-&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; + "&lt;script&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "function test() {\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&nbsp; var oNode = document.getElementById('middle');\n"<br>-&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; + "&nbsp; oNode.insertAdjacentHTML('" + beforeEnd + "', ' \
&lt;span id=3&gt;before end&lt;/span&gt; ');\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; + "&nbsp; oNode.insertAdjacentHTML('" + afterEnd + "', ' &lt;span \
id=4&gt;after end&lt;/span&gt; ');\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;  \
+ "&nbsp; oNode.insertAdjacentHTML('" + beforeBegin + "', ' &lt;span id=1&gt;before \
begin&lt;/span&gt; ');\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; \
oNode.insertAdjacentHTML('" + afterBegin + "', ' &lt;span id=2&gt;after \
begin&lt;/span&gt; ');\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; var \
coll = document.getElementsByTagName('SPAN');\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; + "&nbsp; for (var i=0; i&lt;coll.length; i++) {\n"<br>-&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; &nbsp; alert(coll[i].id);\n"<br>-&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; }\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "}\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&lt;/script&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&lt;/head&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&lt;body \
onload='test()'&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&lt;span \
id='outside'  style='color: #00ff00'&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "&lt;span id='middle' style='color: #ff0000'&gt;\n"<br>-&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; + "inside\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&lt;/span&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&lt;/span&gt;\n"<br>-&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&lt;/body&gt;&lt;/html&gt;";<br>-&nbsp; &nbsp; &nbsp; &nbsp; final HtmlPage page = \
loadPageWithAlerts(html);<br>-&nbsp; &nbsp; &nbsp; &nbsp; final HtmlElement elt = \
page.getHtmlElementById("outside");<br>-&nbsp; &nbsp; &nbsp; &nbsp; \
assertEquals("before begin after begin inside before end after end", \
elt.asText());<br>-&nbsp; &nbsp; }<br>-<br>-&nbsp; &nbsp; /**<br>-&nbsp; &nbsp;  * \
@throws Exception if the test fails<br>-&nbsp; &nbsp;  */<br>-&nbsp; &nbsp; \
@Test<br>-&nbsp; &nbsp; @Browsers(IE)<br>-&nbsp; &nbsp; @Alerts({ "outside", "1", \
"middle", "2", "3", "4" })<br>&nbsp; &nbsp;  public  void insertAdjacentElement() \
throws Exception {<br>&nbsp; &nbsp; &nbsp; &nbsp;  insertAdjacentElement("beforeEnd", \
"afterEnd", "beforeBegin", "afterBegin");<br>&nbsp; &nbsp; &nbsp; &nbsp;  \
insertAdjacentElement("BeforeEnd", "AfterEnd", "BeFoReBeGiN", \
"afterbegin");<br><br>Modified: \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLEl \
ementTest.java<br>===================================================================<br>--- \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java&nbsp;&nbsp;&nbsp; \
2013-10-30 19:38:15 UTC (rev 8715)<br>+++ \
trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLElementTest.java&nbsp;&nbsp;&nbsp; \
2013-10-30 20:18:48 UTC (rev 8716)<br>@@ -4233,4 +4233,55 @@<br> <br>&nbsp; &nbsp; \
&nbsp; &nbsp;  loadPageWithAlerts2(html);<br>&nbsp; &nbsp;  }<br>+<br>+&nbsp; &nbsp; \
/**<br>+&nbsp; &nbsp;  * @throws Exception if the test  fails<br>+&nbsp; &nbsp;  \
*/<br>+&nbsp; &nbsp; @Test<br>+&nbsp; &nbsp; @Alerts({ "outside", "1", "middle", "2", \
"3", "4",<br>+&nbsp; &nbsp; &nbsp; &nbsp; "before begin after begin inside before end \
after end" })<br>+&nbsp; &nbsp; public void insertAdjacentHTML() throws Exception \
{<br>+&nbsp; &nbsp; &nbsp; &nbsp; insertAdjacentHTML("beforeEnd", "afterEnd", \
"beforeBegin", "afterBegin");<br>+&nbsp; &nbsp; &nbsp; &nbsp; \
insertAdjacentHTML("BeforeEnd", "AfterEnd", "BeFoReBeGiN", "afterbegin");<br>+&nbsp; \
&nbsp; }<br>+<br>+&nbsp; &nbsp; /**<br>+&nbsp; &nbsp;  * @param beforeEnd data to \
insert<br>+&nbsp; &nbsp;  * @param afterEnd data to insert<br>+&nbsp; &nbsp;  * \
@param beforeBegin data to insert<br>+&nbsp; &nbsp;  * @param afterBegin data to \
insert<br>+&nbsp; &nbsp;  * @throws Exception if the test fails<br>+&nbsp; &nbsp;  \
*/<br>+&nbsp; &nbsp; private void insertAdjacentHTML(final String \
beforeEnd,<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; final String  afterEnd, \
final String beforeBegin, final String afterBegin) throws Exception {<br>+&nbsp; \
&nbsp; &nbsp; &nbsp; final String html = \
"&lt;html&gt;&lt;head&gt;&lt;title&gt;First&lt;/title&gt;\n"<br>+&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; + "&lt;script&gt;\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "function test() {\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&nbsp; var oNode = document.getElementById('middle');\n"<br>+&nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; + "&nbsp; oNode.insertAdjacentHTML('" + beforeEnd + "', ' \
&lt;span id=3&gt;before end&lt;/span&gt; ');\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; + "&nbsp; oNode.insertAdjacentHTML('" + afterEnd + "', ' &lt;span \
id=4&gt;after end&lt;/span&gt; ');\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + \
"&nbsp; oNode.insertAdjacentHTML('" + beforeBegin + "', ' &lt;span id=1&gt;before \
begin&lt;/span&gt; ');\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp;  \
oNode.insertAdjacentHTML('" + afterBegin + "', ' &lt;span id=2&gt;after \
begin&lt;/span&gt; ');\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; var \
coll = document.getElementsByTagName('SPAN');\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; &nbsp; + "&nbsp; for (var i=0; i&lt;coll.length; i++) {\n"<br>+&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; &nbsp; alert(coll[i].id);\n"<br>+&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; }\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "&nbsp; var outside = document.getElementById('outside');\n"<br>+&nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; var text = outside.textContent ? \
outside.textContent : outside.innerText;\n"<br>+&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; \
&nbsp; + "&nbsp; text = text.replace(/(\\r\\n|\\r|\\n)/gm, '');\n"<br>+&nbsp; &nbsp; \
&nbsp; &nbsp; &nbsp; &nbsp; + "&nbsp; text = text.replace(/(\\s{2,})/g, ' \
 loadPageWithAlerts2(html);<br>+&nbsp; &nbsp; }<br> \
}<br><br><br>------------------------------------------------------------------------------<br>Android \
is increasing in popularity, but the open development platform that<br>developers \
love is also attractive to malware creators. Download this white<br>paper to learn \
more about secure code signing practices that can help keep<br>Android apps \
secure.<br><a href="http://pubads.g.doubleclick.net/gampad/clk?id=65839951&amp;iu=/4140/ostg.clktrk" \
target="_blank">http://pubads.g.doubleclick.net/gampad/clk?id=65839951&amp;iu=/4140/os \
tg.clktrk</a><br>_______________________________________________<br>HtmlUnit-develop \
mailing list<br><a ymailto="mailto:HtmlUnit-develop@lists.sourceforge.net" \
href="mailto:HtmlUnit-develop@lists.sourceforge.net">HtmlUnit-develop@lists.sourceforge.net</a><br><a \
href="https://lists.sourceforge.net/lists/listinfo/htmlunit-develop"  \
target="_blank">https://lists.sourceforge.net/lists/listinfo/htmlunit-develop</a><br><br><br></div> \
</div> </div>  </div></body></html>



------------------------------------------------------------------------------
Android is increasing in popularity, but the open development platform that
developers love is also attractive to malware creators. Download this white
paper to learn more about secure code signing practices that can help keep
Android apps secure.
http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk

_______________________________________________
HtmlUnit-develop mailing list
HtmlUnit-develop@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic