Skip to content

Commit 654349b

Browse files
committed
Fix form's named property behavior / minor code style and add the author
1 parent f32007a commit 654349b

9 files changed

Lines changed: 19 additions & 10 deletions

File tree

src/changes/changes.xml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
<body>
1010
<release version="5.0.0" date="April 01, 2026" description="jdk17, Bugfixes">
11+
<action type="update" dev="Lai Quang Duong">
12+
In sync with the spec, a form now maintains a past names map at the form level, not on individual elements.
13+
The map is populated only when form.xyz resolves to a single element, and entries are invalidated when the element's form owner changes.
14+
</action>
1115
<action type="update" dev="rbri">
1216
Upgrade commons-logging to 1.3.6.
1317
</action>
@@ -20,7 +24,7 @@
2024
<action type="update" dev="RhinoTeam">
2125
core-js: Convert XML objects from 'IdScriptableObject's to descriptors.
2226
</action>
23-
<action type="update" dev="rbri" issue="#1092">
27+
<action type="fix" dev="rbri" issue="#1092">
2428
select.remove() with no arguments now removes itself from the DOM.
2529
</action>
2630
<action type="update" dev="RhinoTeam">

src/main/java/org/htmlunit/html/HtmlButton.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
* @author Ronald Brill
4343
* @author Frank Danek
4444
* @author Sven Strickroth
45+
* @author Lai Quang Duong
4546
*/
4647
public class HtmlButton extends HtmlElement implements DisabledElement, SubmittableElement,
4748
LabelableElement, ValidatableElement {

src/main/java/org/htmlunit/html/HtmlFieldSet.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* @author Ahmed Ashour
2929
* @author Frank Danek
3030
* @author Ronald Brill
31+
* @author Lai Quang Duong
3132
*/
3233
public class HtmlFieldSet extends HtmlElement implements DisabledElement, ValidatableElement {
3334

src/main/java/org/htmlunit/html/HtmlInput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
* @author Frank Danek
5757
* @author Anton Demydenko
5858
* @author Ronny Shapiro
59+
* @author Lai Quang Duong
5960
*/
6061
public abstract class HtmlInput extends HtmlElement implements DisabledElement, SubmittableElement,
6162
ValidatableElement {

src/main/java/org/htmlunit/html/HtmlOutput.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
*
2525
* @author Ronald Brill
2626
* @author Frank Danek
27+
* @author Lai Quang Duong
2728
*/
2829
public class HtmlOutput extends HtmlElement implements LabelableElement, ValidatableElement {
2930

src/main/java/org/htmlunit/html/HtmlSelect.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
* @author Ahmed Ashour
4545
* @author Ronald Brill
4646
* @author Frank Danek
47+
* @author Lai Quang Duong
4748
*/
4849
public class HtmlSelect extends HtmlElement implements DisabledElement, SubmittableElement,
4950
LabelableElement, ValidatableElement {

src/main/java/org/htmlunit/html/HtmlTextArea.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
* @author Amit Khanna
4242
* @author Ronald Brill
4343
* @author Frank Danek
44+
* @author Lai Quang Duong
4445
*/
4546
public class HtmlTextArea extends HtmlElement implements DisabledElement, SubmittableElement,
4647
LabelableElement, SelectableTextInput, ValidatableElement {

src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -105,23 +105,21 @@ public void setName(final String name) {
105105
public HTMLFormControlsCollection getElements() {
106106
final HtmlForm htmlForm = getHtmlForm();
107107

108-
final HTMLFormControlsCollection elements = new HTMLFormControlsCollection(htmlForm,
109-
false) {
108+
final HTMLFormControlsCollection elements = new HTMLFormControlsCollection(htmlForm, false) {
110109
@Override
111110
protected Object getWithPreemption(final String name) {
112-
final List<HtmlElement> elements = findElements(name);
113-
if (elements.isEmpty()) {
111+
final List<HtmlElement> elementsForName = findElements(name);
112+
if (elementsForName.isEmpty()) {
114113
return NOT_FOUND;
115114
}
116-
if (elements.size() == 1) {
117-
return getScriptableFor(elements.get(0));
115+
if (elementsForName.size() == 1) {
116+
return getScriptableFor(elementsForName.get(0));
118117
}
119118

120-
final List<DomNode> nodes = new ArrayList<>(elements);
119+
final List<DomNode> nodes = new ArrayList<>(elementsForName);
121120
final RadioNodeList nodeList = new RadioNodeList(getHtmlForm(), nodes);
122121
nodeList.setElementsSupplier(
123-
(Supplier<List<DomNode>> & Serializable)
124-
() -> new ArrayList<>(findElements(name)));
122+
(Supplier<List<DomNode>> & Serializable) () -> new ArrayList<>(findElements(name)));
125123
return nodeList;
126124
}
127125
};

src/test/java/org/htmlunit/javascript/host/html/HTMLFormElementTest.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
* @author Ahmed Ashour
4848
* @author Ronald Brill
4949
* @author Frank Danek
50+
* @author Lai Quang Duong
5051
*/
5152
public class HTMLFormElementTest extends WebDriverTestCase {
5253

0 commit comments

Comments
 (0)