Quantcast

[HtmlUnit] SVN: [14358] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ javascript/host

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

[HtmlUnit] SVN: [14358] trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/ javascript/host

asashour-2
Revision: 14358
          http://sourceforge.net/p/htmlunit/code/14358
Author:   asashour
Date:     2017-05-04 16:25:52 +0000 (Thu, 04 May 2017)
Log Message:
-----------
Move localName/prefix/namespaceURI down from Node

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DocumentType.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.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-04 15:36:39 UTC (rev 14357)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/Element.java 2017-05-04 16:25:52 UTC (rev 14358)
@@ -1258,4 +1258,31 @@
     @JsxFunction({CHROME, FF})
     public void scrollIntoViewIfNeeded() { /* do nothing at the moment */ }
 
+    /**
+     * Returns the namespace prefix.
+     * @return the namespace prefix
+     */
+    @JsxGetter
+    public Object getPrefix() {
+        return getDomNodeOrDie().getPrefix();
+    }
+
+    /**
+     * Returns the local name of this element.
+     * @return the local name of this element
+     */
+    @JsxGetter
+    public Object getLocalName() {
+        return getDomNodeOrDie().getLocalName();
+    }
+
+    /**
+     * Returns the URI that identifies an XML namespace.
+     * @return the URI that identifies an XML namespace
+     */
+    @JsxGetter
+    public Object getNamespaceURI() {
+        return getDomNodeOrDie().getNamespaceURI();
+    }
+
 }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java 2017-05-04 15:36:39 UTC (rev 14357)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Attr.java 2017-05-04 16:25:52 UTC (rev 14358)
@@ -174,4 +174,31 @@
         return (DomAttr) super.getDomNodeOrDie();
     }
 
+    /**
+     * Returns the namespace prefix.
+     * @return the namespace prefix
+     */
+    @JsxGetter
+    public Object getPrefix() {
+        return getDomNodeOrDie().getPrefix();
+    }
+
+    /**
+     * Returns the local name of this attribute.
+     * @return the local name of this attribute
+     */
+    @JsxGetter
+    public Object getLocalName() {
+        return getDomNodeOrDie().getLocalName();
+    }
+
+    /**
+     * Returns the URI that identifies an XML namespace.
+     * @return the URI that identifies an XML namespace
+     */
+    @JsxGetter
+    public Object getNamespaceURI() {
+        return getDomNodeOrDie().getNamespaceURI();
+    }
+
 }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DocumentType.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DocumentType.java 2017-05-04 15:36:39 UTC (rev 14357)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/DocumentType.java 2017-05-04 16:25:52 UTC (rev 14358)
@@ -14,12 +14,12 @@
  */
 package com.gargoylesoftware.htmlunit.javascript.host.dom;
 
-import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.DOCTYPE_PREFIX_UNDEFINED;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_ENTITIES_NULL;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_DOCTYPE_NOTATIONS_NULL;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.CHROME;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.EDGE;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF;
+import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.FF45;
 import static com.gargoylesoftware.htmlunit.javascript.configuration.SupportedBrowser.IE;
 
 import org.apache.commons.lang3.StringUtils;
@@ -134,41 +134,30 @@
     }
 
     /**
-     * {@inheritDoc}
+     * Returns the namespace prefix.
+     * @return the namespace prefix
      */
-    @Override
+    @JsxGetter({FF45, IE})
     public Object getPrefix() {
-        final Object prefix = super.getPrefix();
-
-        if (prefix == null && getBrowserVersion().hasFeature(DOCTYPE_PREFIX_UNDEFINED)) {
-            return Undefined.instance;
-        }
-        return prefix;
+        return getDomNodeOrDie().getPrefix();
     }
 
     /**
-     * {@inheritDoc}
+     * Returns the local name of this element.
+     * @return the local name of this element
      */
-    @Override
+    @JsxGetter({FF45, IE})
     public Object getLocalName() {
-        final Object localName = super.getLocalName();
-
-        if (localName == null && getBrowserVersion().hasFeature(DOCTYPE_PREFIX_UNDEFINED)) {
-            return Undefined.instance;
-        }
-        return localName;
+        return getDomNodeOrDie().getLocalName();
     }
 
     /**
-     * {@inheritDoc}
+     * Returns the URI that identifies an XML namespace.
+     * @return the URI that identifies an XML namespace
      */
-    @Override
+    @JsxGetter({FF45, IE})
     public Object getNamespaceURI() {
-        final Object namespaceURI = super.getNamespaceURI();
+        return getDomNodeOrDie().getNamespaceURI();
+    }
 
-        if (namespaceURI == null && getBrowserVersion().hasFeature(DOCTYPE_PREFIX_UNDEFINED)) {
-            return Undefined.instance;
-        }
-        return namespaceURI;
-    }
 }

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-05-04 15:36:39 UTC (rev 14357)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/dom/Node.java 2017-05-04 16:25:52 UTC (rev 14358)
@@ -597,34 +597,6 @@
     }
 
     /**
-     * Returns the namespace prefix.
-     * @return the namespace prefix
-     */
-    @JsxGetter
-    public Object getPrefix() {
-        final DomNode domNode = getDomNodeOrDie();
-        return domNode.getPrefix();
-    }
-
-    /**
-     * Returns the local name of this element.
-     * @return the local name of this element
-     */
-    @JsxGetter
-    public Object getLocalName() {
-        return getDomNodeOrDie().getLocalName();
-    }
-
-    /**
-     * Returns The URI that identifies an XML namespace.
-     * @return the URI that identifies an XML namespace
-     */
-    @JsxGetter
-    public Object getNamespaceURI() {
-        return getDomNodeOrDie().getNamespaceURI();
-    }
-
-    /**
      * Compares the positions of this node and the provided node within the document.
      * @param node node object that specifies the node to check
      * @return how the node is positioned relatively to the reference node.


------------------------------------------------------------------------------
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
Loading...