Skip to content

Commit

Permalink
more cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed May 27, 2022
1 parent 9ffc627 commit fcf9378
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 69 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_NUMBER_ACCEPT_ALL;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_NUMBER_DOT_AT_END_IS_DOUBLE;
import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START;

import java.math.BigDecimal;
import java.text.NumberFormat;
Expand Down Expand Up @@ -104,27 +103,6 @@ protected boolean isSubmittableByEnter() {
return true;
}

/**
* {@inheritDoc}
*/
@Override
protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
super.setAttributeNS(namespaceURI, qualifiedName, attributeValue, notifyAttributeChangeListeners,
notifyMutationObservers);
if ("value".equals(qualifiedName)) {
final SgmlPage page = getPage();
if (page != null && page.isHtmlPage()) {
int pos = 0;
if (!hasFeature(JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START)) {
pos = attributeValue.length();
}
setSelectionStart(pos);
setSelectionEnd(pos);
}
}
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
package com.gargoylesoftware.htmlunit.html;

import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START;

import java.util.Map;

import com.gargoylesoftware.htmlunit.SgmlPage;
Expand Down Expand Up @@ -62,27 +60,6 @@ protected boolean isSubmittableByEnter() {
return true;
}

/**
* {@inheritDoc}
*/
@Override
protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
super.setAttributeNS(namespaceURI, qualifiedName, attributeValue, notifyAttributeChangeListeners,
notifyMutationObservers);
if ("value".equals(qualifiedName)) {
final SgmlPage page = getPage();
if (page != null && page.isHtmlPage()) {
int pos = 0;
if (!hasFeature(JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START)) {
pos = attributeValue.length();
}
setSelectionStart(pos);
setSelectionEnd(pos);
}
}
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
*/
package com.gargoylesoftware.htmlunit.html;

import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START;

import java.util.Map;

import com.gargoylesoftware.htmlunit.SgmlPage;
Expand Down Expand Up @@ -143,6 +145,27 @@ public void reset() {
setSelectionEnd(0);
}

/**
* {@inheritDoc}
*/
@Override
protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
super.setAttributeNS(namespaceURI, qualifiedName, attributeValue, notifyAttributeChangeListeners,
notifyMutationObservers);
if ("value".equals(qualifiedName)) {
final SgmlPage page = getPage();
if (page != null && page.isHtmlPage()) {
int pos = 0;
if (!hasFeature(JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START)) {
pos = attributeValue.length();
}
setSelectionStart(pos);
setSelectionEnd(pos);
}
}
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
*/
package com.gargoylesoftware.htmlunit.html;

import static com.gargoylesoftware.htmlunit.BrowserVersionFeatures.JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START;

import java.util.Map;

import com.gargoylesoftware.htmlunit.SgmlPage;
Expand Down Expand Up @@ -55,27 +53,6 @@ protected boolean isSubmittableByEnter() {
return true;
}

/**
* {@inheritDoc}
*/
@Override
protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
super.setAttributeNS(namespaceURI, qualifiedName, attributeValue, notifyAttributeChangeListeners,
notifyMutationObservers);
if ("value".equals(qualifiedName)) {
final SgmlPage page = getPage();
if (page != null && page.isHtmlPage()) {
int pos = 0;
if (!hasFeature(JS_INPUT_SET_VALUE_MOVE_SELECTION_TO_START)) {
pos = attributeValue.length();
}
setSelectionStart(pos);
setSelectionEnd(pos);
}
}
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ public void typeIntegerTooSmall() throws Exception {
*/
@Test
@Alerts(DEFAULT = {"1", "1--null-true", "1", "1--null-true", "1.2", "1.2--null-false"},
FF = {"1", "1--null-true", "", "--null-false", "1.2", "1.2--null-false"},
IE = {"1", "1--null-true", "1.", "1.--null-true", "1.2", "1.2--null-false"})
@HtmlUnitNYI(CHROME = {"1", "1--null-true", "1.", "1.--null-true", "1.2", "1.2--null-false"},
EDGE = {"1", "1--null-true", "1.", "1.--null-true", "1.2", "1.2--null-false"},
Expand Down

0 comments on commit fcf9378

Please sign in to comment.