[HtmlUnit] SVN: [14367] trunk/htmlunit/src

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

[HtmlUnit] SVN: [14367] trunk/htmlunit/src

asashour-2
Revision: 14367
          http://sourceforge.net/p/htmlunit/code/14367
Author:   asashour
Date:     2017-05-04 21:20:20 +0000 (Thu, 04 May 2017)
Log Message:
-----------
JavaScript: MouseEvent to support .pageX and .pageY for all browsers.

Issue 1877

Modified Paths:
--------------
    trunk/htmlunit/src/changes/changes.xml
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEventTest.java

Modified: trunk/htmlunit/src/changes/changes.xml
===================================================================
--- trunk/htmlunit/src/changes/changes.xml 2017-05-04 20:38:26 UTC (rev 14366)
+++ trunk/htmlunit/src/changes/changes.xml 2017-05-04 21:20:20 UTC (rev 14367)
@@ -8,6 +8,9 @@
 
     <body>
         <release version="2.27" date="???" description="GAE broken, Bugfixes">
+            <action type="fix" dev="asashour" issue="1877">
+                JavaScript: MouseEvent to support .pageX and .pageY for all browsers.
+            </action>
             <action type="fix" dev="asashour" issue="1875">
                 JavaScript: fix Object.assign().
             </action>

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2017-05-04 20:38:26 UTC (rev 14366)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEvent.java 2017-05-04 21:20:20 UTC (rev 14367)
@@ -190,7 +190,7 @@
      * @return the horizontal coordinate (currently the same as {@link #getScreenX()})
      * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/event.pageX">Mozilla doc</a>
      */
-    @JsxGetter(FF)
+    @JsxGetter
     public int getPageX() {
         return getScreenX();
     }
@@ -237,7 +237,7 @@
      * @return the horizontal coordinate (currently the same as {@link #getScreenY()})
      * @see <a href="https://developer.mozilla.org/en-US/docs/DOM/event.pageY">Mozilla doc</a>
      */
-    @JsxGetter(FF)
+    @JsxGetter
     public int getPageY() {
         return getScreenY();
     }

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEventTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEventTest.java 2017-05-04 20:38:26 UTC (rev 14366)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/event/MouseEventTest.java 2017-05-04 21:20:20 UTC (rev 14367)
@@ -64,7 +64,6 @@
     @Alerts({"click", "true", "true", "true", "1", "2", "3", "4", "true", "true", "true", "true"})
     public void initMouseEvent() throws Exception {
         final String html = "<html><body><script>\n"
-            + "try {\n"
             + "  var e = document.createEvent('MouseEvents');\n"
             + "  e.initMouseEvent('click', true, true, window, 0, 1, 2, 3, 4, true, true, true, true, 0, null);\n"
             + "  alert(e.type);\n"
@@ -79,7 +78,6 @@
             + "  alert(e.altKey);\n"
             + "  alert(e.shiftKey);\n"
             + "  alert(e.metaKey);\n"
-            + "} catch(e) { alert('exception') }\n"
             + "</script></body></html>";
 
         loadPageWithAlerts2(html);
@@ -239,4 +237,20 @@
         driver.findElement(By.id(id)).click();
         assertEquals(expected[0], textarea.getAttribute("value").trim());
     }
+
+    /**
+     * @throws Exception if an error occurs
+     */
+    @Test
+    @Alerts({"0", "0"})
+    public void pageX() throws Exception {
+        final String html = "<html><body><script>\n"
+            + "  var e = document.createEvent('MouseEvents');\n"
+            + "  alert(e.pageX);\n"
+            + "  alert(e.pageY);\n"
+            + "</script></body></html>";
+
+        loadPageWithAlerts2(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