diff --git a/src/main/java/org/htmlunit/html/FormFieldWithNameHistory.java b/src/main/java/org/htmlunit/html/FormFieldWithNameHistory.java
deleted file mode 100644
index e164d7595c..0000000000
--- a/src/main/java/org/htmlunit/html/FormFieldWithNameHistory.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Copyright (c) 2002-2026 Gargoyle Software Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * https://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.htmlunit.html;
-
-import java.util.Collection;
-
-/**
- * Interface for form fields where the original field name still matters even once it
- * has been changed.
- *
- * Example:
- * With
- * <input name="foo"/>
- * following script will work
- *
- * theForm.foo.name = 'newName';
- * theForm.foo.value = 'some value';
- *
- * Depending on the simulated browser the form field is reachable only through its original name
- * or through all the names it has had.
- * @author Marc Guillemot
- * @author Ronald Brill
- */
-public interface FormFieldWithNameHistory {
-
- /**
- * Gets the first value of the name attribute of this field before any change.
- * @return the original name (which is the same as the current one when no change has been made)
- */
- String getOriginalName();
-
- /**
- * Get all the names this field got after the original one.
- * @return an empty collection if the name attribute has never been changed.
- */
- Collection getNewNames();
-}
diff --git a/src/main/java/org/htmlunit/html/HtmlButton.java b/src/main/java/org/htmlunit/html/HtmlButton.java
index 014a88fe6b..75b6f2a4f9 100644
--- a/src/main/java/org/htmlunit/html/HtmlButton.java
+++ b/src/main/java/org/htmlunit/html/HtmlButton.java
@@ -18,9 +18,6 @@
import static org.htmlunit.html.HtmlForm.ATTRIBUTE_FORMNOVALIDATE;
import java.io.IOException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import org.apache.commons.logging.Log;
@@ -47,7 +44,7 @@
* @author Sven Strickroth
*/
public class HtmlButton extends HtmlElement implements DisabledElement, SubmittableElement,
- LabelableElement, FormFieldWithNameHistory, ValidatableElement {
+ LabelableElement, ValidatableElement {
private static final Log LOG = LogFactory.getLog(HtmlButton.class);
@@ -58,8 +55,6 @@ public class HtmlButton extends HtmlElement implements DisabledElement, Submitta
private static final String TYPE_RESET = "reset";
private static final String TYPE_BUTTON = "button";
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
private String customValidity_;
/**
@@ -72,7 +67,6 @@ public class HtmlButton extends HtmlElement implements DisabledElement, Submitta
HtmlButton(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
- originalName_ = getNameAttribute();
}
/**
@@ -324,39 +318,6 @@ public final String getOnBlurAttribute() {
return getAttributeDirect("onblur");
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
- final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
- final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
- super.setAttributeNS(namespaceURI, qualifiedNameLC, attributeValue, notifyAttributeChangeListeners,
- notifyMutationObservers);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/htmlunit/html/HtmlFieldSet.java b/src/main/java/org/htmlunit/html/HtmlFieldSet.java
index 38918df264..307559b27a 100644
--- a/src/main/java/org/htmlunit/html/HtmlFieldSet.java
+++ b/src/main/java/org/htmlunit/html/HtmlFieldSet.java
@@ -14,9 +14,6 @@
*/
package org.htmlunit.html;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import org.htmlunit.SgmlPage;
@@ -32,13 +29,11 @@
* @author Frank Danek
* @author Ronald Brill
*/
-public class HtmlFieldSet extends HtmlElement implements DisabledElement, ValidatableElement, FormFieldWithNameHistory {
+public class HtmlFieldSet extends HtmlElement implements DisabledElement, ValidatableElement {
/** The HTML tag represented by this element. */
public static final String TAG_NAME = "fieldset";
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
private String customValidity_;
/**
@@ -51,7 +46,6 @@ public class HtmlFieldSet extends HtmlElement implements DisabledElement, Valida
HtmlFieldSet(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
- originalName_ = getAttributeDirect(NAME_ATTRIBUTE);
}
/**
@@ -91,39 +85,6 @@ public boolean isValidValidityState() {
return !isCustomErrorValidityState();
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
- final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
- final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
- super.setAttributeNS(namespaceURI, qualifiedNameLC, attributeValue, notifyAttributeChangeListeners,
- notifyMutationObservers);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/htmlunit/html/HtmlForm.java b/src/main/java/org/htmlunit/html/HtmlForm.java
index bfd075822e..fdedf78457 100644
--- a/src/main/java/org/htmlunit/html/HtmlForm.java
+++ b/src/main/java/org/htmlunit/html/HtmlForm.java
@@ -24,6 +24,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Locale;
@@ -92,6 +93,13 @@ public class HtmlForm extends HtmlElement {
private boolean isPreventDefault_;
+ /**
+ * A map that holds past names (name or id attribute) to elements belonging to this form.
+ * @see
+ * HTML spec - past names map
+ */
+ private Map pastNamesMap_;
+
/**
* Creates an instance.
*
@@ -1005,4 +1013,34 @@ public final void setNoValidate(final boolean noValidate) {
removeAttribute(ATTRIBUTE_NOVALIDATE);
}
}
+
+ /**
+ * Register an element to the past names map with the specified name.
+ * @param name name or id attribute of the element
+ * @param element the element to register
+ */
+ public void registerPastName(final String name, final HtmlElement element) {
+ if (pastNamesMap_ == null) {
+ pastNamesMap_ = new HashMap<>();
+ }
+ pastNamesMap_.put(name, element);
+ }
+
+ /**
+ * Return the element registered in the past names map with the specified name.
+ * If the element is no longer owned by this form, the entry is removed and null is returned.
+ * @param name name or id attribute of the element
+ * @return the element, or null if not found or no longer owned by this form
+ */
+ public HtmlElement getNamedElement(final String name) {
+ if (pastNamesMap_ == null) {
+ return null;
+ }
+ final HtmlElement element = pastNamesMap_.get(name);
+ if (element != null && element.getEnclosingForm() != this) {
+ pastNamesMap_.remove(name);
+ return null;
+ }
+ return element;
+ }
}
diff --git a/src/main/java/org/htmlunit/html/HtmlInput.java b/src/main/java/org/htmlunit/html/HtmlInput.java
index 53a81b6ae2..b05d61ab84 100644
--- a/src/main/java/org/htmlunit/html/HtmlInput.java
+++ b/src/main/java/org/htmlunit/html/HtmlInput.java
@@ -20,9 +20,6 @@
import static org.htmlunit.html.HtmlForm.ATTRIBUTE_FORMNOVALIDATE;
import java.net.MalformedURLException;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Locale;
import java.util.Map;
@@ -61,7 +58,7 @@
* @author Ronny Shapiro
*/
public abstract class HtmlInput extends HtmlElement implements DisabledElement, SubmittableElement,
- FormFieldWithNameHistory, ValidatableElement {
+ ValidatableElement {
private static final Log LOG = LogFactory.getLog(HtmlInput.class);
@@ -70,8 +67,6 @@ public abstract class HtmlInput extends HtmlElement implements DisabledElement,
private String rawValue_;
private boolean isValueDirty_;
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
private boolean valueModifiedByJavascript_;
private Object valueAtFocus_;
private String customValidity_;
@@ -97,7 +92,6 @@ public HtmlInput(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
rawValue_ = getValueAttribute();
- originalName_ = getNameAttribute();
}
/**
@@ -633,12 +627,6 @@ static Page executeOnChangeHandlerIfAppropriate(final HtmlElement htmlElement) {
protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
if (TYPE_ATTRIBUTE.equals(qualifiedNameLC)) {
changeType(attributeValue, true);
@@ -657,22 +645,6 @@ protected void setAttributeNS(final String namespaceURI, final String qualifiedN
notifyMutationObservers);
}
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
-
/**
* INTERNAL API - SUBJECT TO CHANGE AT ANY TIME - USE AT YOUR OWN RISK.
*
@@ -940,17 +912,6 @@ protected boolean isMinMaxLengthSupported() {
return false;
}
- /**
- * {@inheritDoc}
- */
- @Override
- public DomNode cloneNode(final boolean deep) {
- final HtmlInput newnode = (HtmlInput) super.cloneNode(deep);
- newnode.newNames_ = new HashSet<>(newNames_);
-
- return newnode;
- }
-
/**
* Returns if the input element has a maximum allowed value length. Refer to the
* HTML 5
diff --git a/src/main/java/org/htmlunit/html/HtmlOutput.java b/src/main/java/org/htmlunit/html/HtmlOutput.java
index c2470491ac..14488ae6a2 100644
--- a/src/main/java/org/htmlunit/html/HtmlOutput.java
+++ b/src/main/java/org/htmlunit/html/HtmlOutput.java
@@ -14,9 +14,6 @@
*/
package org.htmlunit.html;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import org.htmlunit.SgmlPage;
@@ -28,13 +25,11 @@
* @author Ronald Brill
* @author Frank Danek
*/
-public class HtmlOutput extends HtmlElement implements LabelableElement, ValidatableElement, FormFieldWithNameHistory {
+public class HtmlOutput extends HtmlElement implements LabelableElement, ValidatableElement {
/** The HTML tag represented by this element. */
public static final String TAG_NAME = "output";
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
private String customValidity_;
/**
@@ -47,7 +42,6 @@ public class HtmlOutput extends HtmlElement implements LabelableElement, Validat
HtmlOutput(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
- originalName_ = getAttributeDirect(NAME_ATTRIBUTE);
}
/**
@@ -95,36 +89,4 @@ public boolean isValidValidityState() {
return !isCustomErrorValidityState();
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
- final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
- final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
- super.setAttributeNS(namespaceURI, qualifiedNameLC, attributeValue, notifyAttributeChangeListeners,
- notifyMutationObservers);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
}
diff --git a/src/main/java/org/htmlunit/html/HtmlSelect.java b/src/main/java/org/htmlunit/html/HtmlSelect.java
index f44d59c77d..b0c636ac07 100644
--- a/src/main/java/org/htmlunit/html/HtmlSelect.java
+++ b/src/main/java/org/htmlunit/html/HtmlSelect.java
@@ -17,9 +17,7 @@
import static org.htmlunit.BrowserVersionFeatures.HTMLSELECT_WILL_VALIDATE_IGNORES_READONLY;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Collections;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -48,13 +46,11 @@
* @author Frank Danek
*/
public class HtmlSelect extends HtmlElement implements DisabledElement, SubmittableElement,
- LabelableElement, FormFieldWithNameHistory, ValidatableElement {
+ LabelableElement, ValidatableElement {
/** The HTML tag represented by this element. */
public static final String TAG_NAME = "select";
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
/** What is the index of the HtmlOption which was last selected. */
private int lastSelectedIndex_ = -1;
private String customValidity_;
@@ -69,7 +65,6 @@ public class HtmlSelect extends HtmlElement implements DisabledElement, Submitta
HtmlSelect(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
- originalName_ = getNameAttribute();
}
/**
@@ -652,39 +647,6 @@ public final String getOnChangeAttribute() {
return getAttributeDirect("onchange");
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
- final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
- final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (DomElement.NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
- super.setAttributeNS(namespaceURI, qualifiedNameLC, attributeValue, notifyAttributeChangeListeners,
- notifyMutationObservers);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
-
/**
* {@inheritDoc}
*/
diff --git a/src/main/java/org/htmlunit/html/HtmlTextArea.java b/src/main/java/org/htmlunit/html/HtmlTextArea.java
index 9ce63204db..33367e2176 100644
--- a/src/main/java/org/htmlunit/html/HtmlTextArea.java
+++ b/src/main/java/org/htmlunit/html/HtmlTextArea.java
@@ -15,9 +15,6 @@
package org.htmlunit.html;
import java.io.PrintWriter;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
import java.util.Map;
import org.htmlunit.SgmlPage;
@@ -46,14 +43,12 @@
* @author Frank Danek
*/
public class HtmlTextArea extends HtmlElement implements DisabledElement, SubmittableElement,
- LabelableElement, SelectableTextInput, FormFieldWithNameHistory, ValidatableElement {
+ LabelableElement, SelectableTextInput, ValidatableElement {
/** The HTML tag represented by this element. */
public static final String TAG_NAME = "textarea";
private String defaultValue_;
private String valueAtFocus_;
- private final String originalName_;
- private Collection newNames_ = Collections.emptySet();
private String customValidity_;
private SelectableTextSelectionDelegate selectionDelegate_ = new SelectableTextSelectionDelegate(this);
@@ -69,7 +64,6 @@ public class HtmlTextArea extends HtmlElement implements DisabledElement, Submit
HtmlTextArea(final String qualifiedName, final SgmlPage page,
final Map attributes) {
super(qualifiedName, page, attributes);
- originalName_ = getNameAttribute();
}
/**
@@ -512,39 +506,6 @@ public boolean isReadOnly() {
return hasAttribute("readOnly");
}
- /**
- * {@inheritDoc}
- */
- @Override
- protected void setAttributeNS(final String namespaceURI, final String qualifiedName, final String attributeValue,
- final boolean notifyAttributeChangeListeners, final boolean notifyMutationObservers) {
- final String qualifiedNameLC = StringUtils.toRootLowerCase(qualifiedName);
- if (DomElement.NAME_ATTRIBUTE.equals(qualifiedNameLC)) {
- if (newNames_.isEmpty()) {
- newNames_ = new HashSet<>();
- }
- newNames_.add(attributeValue);
- }
- super.setAttributeNS(namespaceURI, qualifiedNameLC, attributeValue, notifyAttributeChangeListeners,
- notifyMutationObservers);
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public String getOriginalName() {
- return originalName_;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- public Collection getNewNames() {
- return newNames_;
- }
-
/**
* {@inheritDoc}
* @return {@code true} to make generated XML readable as HTML
@@ -596,7 +557,6 @@ public DomNode cloneNode(final boolean deep) {
final HtmlTextArea newnode = (HtmlTextArea) super.cloneNode(deep);
newnode.selectionDelegate_ = new SelectableTextSelectionDelegate(newnode);
newnode.doTypeProcessor_ = new DoTypeProcessor(newnode);
- newnode.newNames_ = new HashSet<>(newNames_);
return newnode;
}
diff --git a/src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java b/src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java
index 958a42c23f..3ded70a056 100644
--- a/src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java
+++ b/src/main/java/org/htmlunit/javascript/host/html/HTMLFormElement.java
@@ -30,7 +30,6 @@
import org.htmlunit.corejs.javascript.ScriptableObject;
import org.htmlunit.html.DomElement;
import org.htmlunit.html.DomNode;
-import org.htmlunit.html.FormFieldWithNameHistory;
import org.htmlunit.html.HtmlAttributeChangeEvent;
import org.htmlunit.html.HtmlElement;
import org.htmlunit.html.HtmlForm;
@@ -110,7 +109,20 @@ public HTMLFormControlsCollection getElements() {
false) {
@Override
protected Object getWithPreemption(final String name) {
- return HTMLFormElement.this.getWithPreemption(name);
+ final List elements = findElements(name);
+ if (elements.isEmpty()) {
+ return NOT_FOUND;
+ }
+ if (elements.size() == 1) {
+ return getScriptableFor(elements.get(0));
+ }
+
+ final List nodes = new ArrayList<>(elements);
+ final RadioNodeList nodeList = new RadioNodeList(getHtmlForm(), nodes);
+ nodeList.setElementsSupplier(
+ (Supplier> & Serializable)
+ () -> new ArrayList<>(findElements(name)));
+ return nodeList;
}
};
@@ -366,6 +378,8 @@ public void reset() {
/**
* Overridden to allow the retrieval of certain form elements by ID or name.
+ * @see
+ * HTML spec - form named item
*
* @param name {@inheritDoc}
* @return {@inheritDoc}
@@ -378,10 +392,13 @@ protected Object getWithPreemption(final String name) {
final List elements = findElements(name);
if (elements.isEmpty()) {
- return NOT_FOUND;
+ final HtmlElement element = getHtmlForm().getNamedElement(name);
+ return element != null ? getScriptableFor(element) : NOT_FOUND;
}
if (elements.size() == 1) {
- return getScriptableFor(elements.get(0));
+ final HtmlElement element = elements.get(0);
+ getHtmlForm().registerPastName(name, element);
+ return getScriptableFor(element);
}
final List nodes = new ArrayList<>(elements);
@@ -441,7 +458,8 @@ List findElements(final String name) {
}
for (final HtmlElement element : form.getElementsJS()) {
- if (isAccessibleByIdOrName(element, name)) {
+ if (name.equals(element.getId())
+ || name.equals(element.getAttributeDirect(DomElement.NAME_ATTRIBUTE))) {
elements.add(element);
}
}
@@ -467,7 +485,8 @@ private HtmlElement findFirstElement(final String name) {
}
for (final HtmlElement node : form.getElementsJS()) {
- if (isAccessibleByIdOrName(node, name)) {
+ if (name.equals(node.getId())
+ || name.equals(node.getAttributeDirect(DomElement.NAME_ATTRIBUTE))) {
return node;
}
}
@@ -484,35 +503,6 @@ private HtmlElement findFirstElement(final String name) {
return null;
}
- /**
- * Indicates if the element can be reached by id or name in expressions like "myForm.myField".
- * @param element the element to test
- * @param name the name used to address the element
- * @return {@code true} if this element matches the conditions
- */
- private static boolean isAccessibleByIdOrName(final HtmlElement element, final String name) {
- if (name.equals(element.getId())) {
- return true;
- }
-
- if (name.equals(element.getAttributeDirect(DomElement.NAME_ATTRIBUTE))) {
- return true;
- }
-
- if (element instanceof FormFieldWithNameHistory elementWithNames) {
-
- if (name.equals(elementWithNames.getOriginalName())) {
- return true;
- }
-
- if (elementWithNames.getNewNames().contains(name)) {
- return true;
- }
- }
-
- return false;
- }
-
/**
* Returns the specified indexed property.
* @param index the index of the property
diff --git a/src/test/java/org/htmlunit/javascript/host/html/HTMLFormElementTest.java b/src/test/java/org/htmlunit/javascript/host/html/HTMLFormElementTest.java
index 69a2b118b6..18d3b4c764 100644
--- a/src/test/java/org/htmlunit/javascript/host/html/HTMLFormElementTest.java
+++ b/src/test/java/org/htmlunit/javascript/host/html/HTMLFormElementTest.java
@@ -2532,6 +2532,101 @@ public void accessByNameAfterNameChangeFieldSet() throws Exception {
accessByNameAfterNameChange("");
}
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertyInput() throws Exception {
+ formNamedProperty("");
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertyButton() throws Exception {
+ formNamedProperty("");
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertyTextarea() throws Exception {
+ formNamedProperty("");
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertyOutput() throws Exception {
+ formNamedProperty("");
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertyFieldset() throws Exception {
+ formNamedProperty("");
+ }
+
+ /**
+ * @throws Exception if the test fails
+ */
+ @Test
+ @Alerts({"undefined", "false", "foobar", "true",
+ "undefined", "undefined", "foobar"})
+ public void formNamedPropertySelect() throws Exception {
+ formNamedProperty("");
+ }
+
+ private void formNamedProperty(final String htmlElement) throws Exception {
+ final String html = DOCTYPE_HTML
+ + "\n"
+ + "\n"
+ + "\n"
+ + "\n"
+ + "";
+
+ loadPageVerifyTitle2(html);
+ }
+
private void accessByNameAfterNameChange(final String htmlElement) throws Exception {
final String html = DOCTYPE_HTML
+ "