Quantcast

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

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: [14343] trunk/htmlunit/src

rbri
Revision: 14343
          http://sourceforge.net/p/htmlunit/code/14343
Author:   rbri
Date:     2017-05-04 07:44:01 +0000 (Thu, 04 May 2017)
Log Message:
-----------
FF52

Modified Paths:
--------------
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
    trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement.java
    trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-05-04 07:31:13 UTC (rev 14342)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/BrowserVersionFeatures.java 2017-05-04 07:44:01 UTC (rev 14343)
@@ -416,6 +416,10 @@
     @BrowserFeature(IE)
     HTMLINPUT_DOES_NOT_CLICK_SURROUNDING_ANCHOR,
 
+    /** HTMLInputElement: type {@code file} selectionSart/End are null. */
+    @BrowserFeature({CHROME, FF52})
+    HTMLINPUT_FILE_SELECTION_START_END_NULL,
+
     /** HTMLInputElement: {@code files} to be {@code undefined}. */
     @BrowserFeature(IE)
     HTMLINPUT_FILES_UNDEFINED,

Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement.java
===================================================================
--- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement.java 2017-05-04 07:31:13 UTC (rev 14342)
+++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/html/HTMLInputElement.java 2017-05-04 07:44:01 UTC (rev 14343)
@@ -16,6 +16,7 @@
 
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.EVENT_ONCLICK_USES_POINTEREVENT;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_FILES_UNDEFINED;
+import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_FILE_SELECTION_START_END_NULL;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_FILE_VALUE_FAKEPATH;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.HTMLINPUT_FILE_VALUE_NO_PATH;
 import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_ALIGN_FOR_INPUT_IGNORES_VALUES;
@@ -325,7 +326,7 @@
             return ((SelectableTextInput) dom).getSelectionStart();
         }
 
-        if (getBrowserVersion().hasFeature(HTMLINPUT_FILE_VALUE_FAKEPATH)) {
+        if (getBrowserVersion().hasFeature(HTMLINPUT_FILE_SELECTION_START_END_NULL)) {
             return null;
         }
         throw Context.reportRuntimeError("Failed to read the 'selectionStart' property from 'HTMLInputElement': "
@@ -371,7 +372,7 @@
             return ((SelectableTextInput) dom).getSelectionEnd();
         }
 
-        if (getBrowserVersion().hasFeature(HTMLINPUT_FILE_VALUE_FAKEPATH)) {
+        if (getBrowserVersion().hasFeature(HTMLINPUT_FILE_SELECTION_START_END_NULL)) {
             return null;
         }
         throw Context.reportRuntimeError("Failed to read the 'selectionEnd' property from 'HTMLInputElement': "

Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java
===================================================================
--- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java 2017-05-04 07:31:13 UTC (rev 14342)
+++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/html/HtmlFileInputTest.java 2017-05-04 07:44:01 UTC (rev 14343)
@@ -873,9 +873,9 @@
      * @throws Exception if an error occurs
      */
     @Test
-    @Alerts(DEFAULT = "exception",
-            CHROME = "0",
-            FF52 = "0")
+    @Alerts(DEFAULT = {"ex start", "ex end", "exception"},
+            CHROME = {"null", "null", "0"},
+            FF52 = {"null", "null", "0"})
     public void selection() throws Exception {
         final String html =
               "<html><head><script>\n"
@@ -887,6 +887,12 @@
             + "  }\n"
             + "  function getSelection(element) {\n"
             + "    try {\n"
+            + "      alert(element.selectionStart);\n"
+            + "    } catch(e) { alert('ex start'); }\n"
+            + "    try {\n"
+            + "      alert(element.selectionEnd);\n"
+            + "    } catch(e) { alert('ex end'); }\n"
+            + "    try {\n"
             + "      return element.value.substring(element.selectionStart, element.selectionEnd);\n"
             + "    } catch(e) { alert('exception'); }\n"
             + "  }\n"


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