[HtmlUnit] SVN: [14462] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ javascript/host/Element.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[HtmlUnit] SVN: [14462] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ javascript/host/Element.java

rbri
Revision: 14462
          http://sourceforge.net/p/htmlunit/code/14462
Author:   rbri
Date:     2017-05-18 18:04:02 +0000 (Thu, 18 May 2017)
Log Message:
-----------
avoid CCE in innerText when the element contains a SvgElement / fix my last fix

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2017-05-17 19:07:31 UTC (rev 14461)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2017-05-18 18:04:02 UTC (rev 14462)
@@ -72,7 +72,6 @@
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLElement.ProxyDomNode;
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLScriptElement;
 import com.gargoylesoftware.htmlunit.javascript.host.html.HTMLStyleElement;
-import com.gargoylesoftware.htmlunit.svg.SvgElement;
 
 import net.sourceforge.htmlunit.corejs.javascript.BaseFunction;
 import net.sourceforge.htmlunit.corejs.javascript.Context;
@@ -1050,9 +1049,6 @@
             }
             builder.append(s);
         }
-        else if (node instanceof SvgElement) {
-            // nothing to do for the moment
-        }
         else if (html) {
             final DomElement element = (DomElement) node;
             final Element scriptObject = (Element) node.getScriptableObject();
@@ -1087,23 +1083,25 @@
             }
         }
         else {
-            final HtmlElement element = (HtmlElement) node;
-            if ("p".equals(element.getTagName())) {
-                if (getBrowserVersion().hasFeature(JS_INNER_TEXT_CR_NL)) {
-                    builder.append("\r\n"); // \r\n because it's to implement something IE specific
-                }
-                else {
-                    int i = builder.length() - 1;
-                    while (i >= 0 && Character.isWhitespace(builder.charAt(i))) {
-                        i--;
+            if (node instanceof HtmlElement) {
+                final HtmlElement element = (HtmlElement) node;
+                if ("p".equals(element.getTagName())) {
+                    if (getBrowserVersion().hasFeature(JS_INNER_TEXT_CR_NL)) {
+                        builder.append("\r\n"); // \r\n because it's to implement something IE specific
                     }
-                    builder.setLength(i + 1);
-                    builder.append("\n");
+                    else {
+                        int i = builder.length() - 1;
+                        while (i >= 0 && Character.isWhitespace(builder.charAt(i))) {
+                            i--;
+                        }
+                        builder.setLength(i + 1);
+                        builder.append("\n");
+                    }
                 }
+                if (!"script".equals(element.getTagName())) {
+                    printChildren(builder, node, html);
+                }
             }
-            if (!"script".equals(element.getTagName())) {
-                printChildren(builder, node, html);
-            }
         }
     }
 


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
HtmlUnit-develop mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/htmlunit-develop