Skip to content

Commit 3ce40a9

Browse files
committed
more cleanup of froms
1 parent c997b87 commit 3ce40a9

File tree

3 files changed

+8
-25
lines changed

3 files changed

+8
-25
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,7 +1022,13 @@ protected void checkChildHierarchy(final Node childNode) throws DOMException {
10221022
super.checkChildHierarchy(childNode);
10231023
}
10241024

1025-
void setOwningForm(final HtmlForm form) {
1025+
/**
1026+
* <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
1027+
*
1028+
* Allows the parser to connect to a form that is not a parent of this due to malformed HTML code
1029+
* @param form the owning form
1030+
*/
1031+
public void setOwningForm(final HtmlForm form) {
10261032
owningForm_ = form;
10271033
}
10281034

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

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,6 @@ public class HtmlForm extends HtmlElement {
9494

9595
private static final Pattern SUBMIT_CHARSET_PATTERN = Pattern.compile("[ ,].*");
9696

97-
private final List<HtmlElement> lostChildren_ = new ArrayList<>();
98-
9997
private boolean isPreventDefault_;
10098

10199
/**
@@ -932,27 +930,6 @@ public List<HtmlInput> getInputsByValue(final String value) {
932930
return results;
933931
}
934932

935-
/**
936-
* <span style="color:red">INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.</span><br>
937-
*
938-
* Allows the parser to notify the form of a field that doesn't belong to its DOM children
939-
* due to malformed HTML code
940-
* @param field the form field
941-
*/
942-
public void addLostChild(final HtmlElement field) {
943-
lostChildren_.add(field);
944-
field.setOwningForm(this);
945-
}
946-
947-
/**
948-
* Gets the form elements that may be submitted but that don't belong to the form's children
949-
* in the DOM due to incorrect HTML code.
950-
* @return the elements
951-
*/
952-
public List<HtmlElement> getLostChildren() {
953-
return lostChildren_;
954-
}
955-
956933
/**
957934
* {@inheritDoc}
958935
*/

src/main/java/org/htmlunit/html/parser/neko/HtmlUnitNekoDOMBuilder.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ else if (consumingForm_ != null) {
398398
if (newElement instanceof SubmittableElement) {
399399
// Let these be owned by the form
400400
if (((HtmlElement) newElement).getEnclosingForm() != consumingForm_) {
401-
consumingForm_.addLostChild((HtmlElement) newElement);
401+
((HtmlElement) newElement).setOwningForm(consumingForm_);
402402
}
403403
}
404404
}

0 commit comments

Comments
 (0)