Class HTMLSelectElement
java.lang.Object
org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.javascript.HtmlUnitScriptable
org.htmlunit.javascript.host.event.EventTarget
org.htmlunit.javascript.host.dom.Node
org.htmlunit.javascript.host.Element
org.htmlunit.javascript.host.html.HTMLElement
org.htmlunit.javascript.host.html.HTMLSelectElement
- All Implemented Interfaces:
Serializable, Cloneable, org.htmlunit.corejs.javascript.ConstProperties, org.htmlunit.corejs.javascript.debug.DebuggableObject, org.htmlunit.corejs.javascript.Scriptable, org.htmlunit.corejs.javascript.SymbolScriptable
-
Nested Class Summary
Nested classes/interfaces inherited from class HTMLElement
HTMLElement.ProxyDomNodeNested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NodeList"Live" labels collection; has to be a member to have equality (==) working.private HTMLOptionsCollectionFields inherited from class Node
ATTRIBUTE_NODE, CDATA_SECTION_NODE, COMMENT_NODE, DOCUMENT_FRAGMENT_NODE, DOCUMENT_NODE, DOCUMENT_POSITION_CONTAINED_BY, DOCUMENT_POSITION_CONTAINS, DOCUMENT_POSITION_DISCONNECTED, DOCUMENT_POSITION_FOLLOWING, DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC, DOCUMENT_POSITION_PRECEDING, DOCUMENT_TYPE_NODE, ELEMENT_NODE, ENTITY_NODE, ENTITY_REFERENCE_NODE, NOTATION_NODE, PROCESSING_INSTRUCTION_NODE, TEXT_NODEFields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONSTFields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(HTMLOptionElement newOptionObject, Object beforeOptionObject) Adds a new item to the list (optionally) before the specified item.appendChild(Object childObject) Adds a DOM node to the node.booleanChecks whether the element has any constraints and whether it satisfies them.get(int index, org.htmlunit.corejs.javascript.Scriptable start) Returns the specified indexed property.Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.getForm()Returns the value of the JavaScriptformattribute.Returns the labels associated with the element.intReturns the value of thelengthproperty.getName()Returns the value of the JavaScript attributename.Returns the value of theoptionsproperty.intReturns the value of theselectedIndexproperty.intgetSize()Returns thesizeattribute.getType()Returns the type of this input.getValue()Returns the actual value of the selected Option.booleanvoidInitialize the object.insertBeforeImpl(Object[] args) Add a DOM node as a child to this node before the referenced node.booleanReturns true if this element is disabled.booleanReturnstrueif themultipleattribute is set.booleanReturns therequiredproperty.item(int index) Gets the item at the specified index.org.htmlunit.corejs.javascript.Scriptableiterator()voidJavaScript constructor.voidSets the index property.voidremove(int index) Removes option at the specified index.voidsetCustomValidity(String message) Sets the custom validity message for the element to the specified message.voidsetDisabled(boolean disabled) Sets whether or not to disable this element.voidsetLength(int newLength) Removes options by reducing thelengthproperty.voidsetMultiple(boolean multiple) Sets or clears themultipleattribute.voidSets the value of the JavaScript attributename.voidsetRequired(boolean required) Sets therequiredproperty.voidsetSelectedIndex(int index) Sets the value of theselectedIndexproperty.voidSets thesizeattribute.voidSelects the option with the specified value.Methods inherited from class HTMLElement
blur, click, focus, getAccessKey, getAlign, getAttributeNode, getAutofocus, getBoundingClientRect, getCh, getChOff, getContentEditable, getDataset, getDir, getDomNodeOrNull, getEnterKeyHint, getInnerText, getLang, getLocalName, getNodeName, getOffsetHeight, getOffsetLeft, getOffsetParent_js, getOffsetTop, getOffsetWidth, getOnabort, getOnanimationcancel, getOnanimationend, getOnanimationiteration, getOnanimationstart, getOnauxclick, getOnblur, getOncancel, getOncanplay, getOncanplaythrough, getOnchange, getOnclick, getOnclose, getOncontextmenu, getOncopy, getOncuechange, getOncut, getOndblclick, getOndrag, getOndragend, getOndragenter, getOndragleave, getOndragover, getOndragstart, getOndrop, getOndurationchange, getOnemptied, getOnended, getOnerror, getOnfocus, getOngotpointercapture, getOninput, getOninvalid, getOnkeydown, getOnkeypress, getOnkeyup, getOnload, getOnloadeddata, getOnloadedmetadata, getOnloadstart, getOnlostpointercapture, getOnmousedown, getOnmouseenter, getOnmouseleave, getOnmousemove, getOnmouseout, getOnmouseover, getOnmouseup, getOnmousewheel, getOnmozfullscreenchange, getOnmozfullscreenerror, getOnpaste, getOnpause, getOnplay, getOnplaying, getOnpointercancel, getOnpointerdown, getOnpointerenter, getOnpointerleave, getOnpointermove, getOnpointerout, getOnpointerover, getOnpointerup, getOnprogress, getOnratechange, getOnreset, getOnresize, getOnscroll, getOnscrollend, getOnseeked, getOnseeking, getOnselect, getOnselectionchange, getOnselectstart, getOnstalled, getOnsubmit, getOnsuspend, getOntimeupdate, getOntoggle, getOntransitioncancel, getOntransitionend, getOntransitionrun, getOntransitionstart, getOnvolumechange, getOnwaiting, getOnwheel, getOuterText, getParentHTMLElement, getPosX, getPosY, getPrefix, getStyle, getTabIndex, getTitle, getVAlign, getWidthOrHeight, isAncestorOfEventTarget, isEndTagForbidden, isHidden, isIsContentEditable, isLowerCaseInOuterHtml, isSpellcheck, setAccessKey, setAlign, setAttribute, setAutofocus, setCh, setChOff, setColorAttribute, setContentEditable, setDir, setDomNode, setEnterKeyHint, setHidden, setInnerText, setLang, setOnabort, setOnanimationcancel, setOnanimationend, setOnanimationiteration, setOnanimationstart, setOnauxclick, setOnblur, setOncancel, setOncanplay, setOncanplaythrough, setOnchange, setOnclick, setOnclose, setOncontextmenu, setOncopy, setOncuechange, setOncut, setOndblclick, setOndrag, setOndragend, setOndragenter, setOndragleave, setOndragover, setOndragstart, setOndrop, setOndurationchange, setOnemptied, setOnended, setOnerror, setOnfocus, setOngotpointercapture, setOninput, setOninvalid, setOnkeydown, setOnkeypress, setOnkeyup, setOnload, setOnloadeddata, setOnloadedmetadata, setOnloadstart, setOnlostpointercapture, setOnmousedown, setOnmouseenter, setOnmouseleave, setOnmousemove, setOnmouseout, setOnmouseover, setOnmouseup, setOnmousewheel, setOnmozfullscreenchange, setOnmozfullscreenerror, setOnpaste, setOnpause, setOnplay, setOnplaying, setOnpointercancel, setOnpointerdown, setOnpointerenter, setOnpointerleave, setOnpointermove, setOnpointerout, setOnpointerover, setOnpointerup, setOnprogress, setOnratechange, setOnreset, setOnresize, setOnscroll, setOnscrollend, setOnseeked, setOnseeking, setOnselect, setOnselectionchange, setOnselectstart, setOnstalled, setOnsubmit, setOnsuspend, setOntimeupdate, setOntoggle, setOntransitioncancel, setOntransitionend, setOntransitionrun, setOntransitionstart, setOnvolumechange, setOnwaiting, setOnwheel, setOuterText, setSpellcheck, setStyle, setTabIndex, setTextContent, setTitle, setVAlign, setWidthOrHeight, toStringMethods inherited from class Element
after, append, before, closest, createAttributesObject, createEventHandler, getAttribute, getAttributeNodeNS, getAttributeNS, getAttributes, getChildElementCount, getChildren, getClassList, getClassName_js, getClientHeight, getClientLeft, getClientRects, getClientTop, getClientWidth, getElementsByClassName, getElementsByTagName, getElementsByTagNameNS, getFirstElementChild, getId, getInnerHTML, getInnerHTML, getLastElementChild, getNamespaceURI, getNextElementSibling, getOnbeforecopy, getOnbeforecut, getOnbeforepaste, getOnsearch, getOnwebkitfullscreenchange, getOnwebkitfullscreenerror, getOuterHTML, getParentElement, getPreviousElementSibling, getScrollHeight, getScrollLeft, getScrollTop, getScrollWidth, getTagName, hasAttribute, hasAttributeNS, hasAttributes, innerHTML, insertAdjacentElement, insertAdjacentHTML, insertAdjacentText, isDisplayNone, matches, mozMatchesSelector, prepend, printChildren, printNode, querySelector, querySelectorAll, releaseCapture, remove, removeAttribute, removeAttributeNode, removeAttributeNS, replaceChildren, replaceWith, scroll, scrollBy, scrollIntoView, scrollIntoViewIfNeeded, scrollTo, setAttributeNode, setAttributeNS, setCapture, setClassName_js, setId, setInnerHTML, setOnbeforecopy, setOnbeforecut, setOnbeforepaste, setOnsearch, setOnwebkitfullscreenchange, setOnwebkitfullscreenerror, setOuterHTML, setScrollLeft, setScrollTop, toggleAttribute, webkitMatchesSelectorMethods inherited from class Node
after, append, before, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getRootNode, getTextContent, hasChildNodes, insertBefore, isEqualNode, isSameNode, normalize, prepend, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValueMethods inherited from class EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandlerMethods inherited from class HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getDefaultValue, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromiseMethods inherited from class org.htmlunit.corejs.javascript.ScriptableObject
applyDescriptorToAttributeBitset, associateValue, avoidObjectDetection, buildDataDescriptor, callMethod, callMethod, checkPropertyChange, checkPropertyDefinition, defineClass, defineClass, defineClass, defineConst, defineConstProperty, defineFunctionProperties, defineOwnProperties, defineOwnProperty, defineOwnProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, defineProperty, delete, delete, delete, deleteProperty, deleteProperty, deleteProperty, ensureScriptable, ensureScriptableObject, ensureSymbolScriptable, get, get, getAllIds, getArrayPrototype, getAssociatedValue, getAttributes, getAttributes, getAttributes, getAttributes, getAttributes, getClassPrototype, getDefaultValue, getExternalArrayData, getExternalArrayLength, getFunctionPrototype, getGeneratorFunctionPrototype, getGetterOrSetter, getGetterOrSetter, getIds, getObjectPrototype, getOwnPropertyDescriptor, getParentScope, getProperty, getProperty, getProperty, getPropertyIds, getPrototype, getTopLevelScope, getTopScopeValue, getTypedProperty, getTypedProperty, getTypeOf, has, has, hasProperty, hasProperty, hasProperty, isAccessorDescriptor, isConst, isDataDescriptor, isEmpty, isExtensible, isFalse, isGenericDescriptor, isGetterOrSetter, isSealed, isTrue, preventExtensions, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
Field Details
-
optionsArray_
-
labels_
"Live" labels collection; has to be a member to have equality (==) working.
-
-
Constructor Details
-
HTMLSelectElement
public HTMLSelectElement()Creates an instance.
-
-
Method Details
-
jsConstructor
-
initialize
public void initialize()Initialize the object. -
getDomNodeOrDie
Returns the DOM node that corresponds to this JavaScript object or throw an exception if one cannot be found.- Overrides:
getDomNodeOrDiein classHTMLElement- Returns:
- the DOM node
-
remove
public void remove(int index) Removes option at the specified index.- Parameters:
index- the index of the item to remove
-
add
Adds a new item to the list (optionally) before the specified item.- Parameters:
newOptionObject- the DomNode to insertbeforeOptionObject- the DomNode to insert the previous element before (null if at end).
-
appendChild
Adds a DOM node to the node.- Overrides:
appendChildin classNode- Parameters:
childObject- the node to add to this node- Returns:
- the newly added child node
-
insertBeforeImpl
Add a DOM node as a child to this node before the referenced node. If the referenced node is null, append to the end.- Overrides:
insertBeforeImplin classNode- Parameters:
args- the arguments- Returns:
- the newly added child node
-
item
Gets the item at the specified index.- Parameters:
index- the position of the option to retrieve- Returns:
- the option
-
getType
-
getOptions
Returns the value of theoptionsproperty.- Returns:
- the
optionsproperty
-
getSelectedIndex
public int getSelectedIndex()Returns the value of theselectedIndexproperty.- Returns:
- the
selectedIndexproperty
-
setSelectedIndex
public void setSelectedIndex(int index) Sets the value of theselectedIndexproperty.- Parameters:
index- the new value
-
getValue
Returns the actual value of the selected Option.- Overrides:
getValuein classHTMLElement- Returns:
- the value
-
getLength
public int getLength()Returns the value of thelengthproperty.- Returns:
- the
lengthproperty
-
setLength
public void setLength(int newLength) Removes options by reducing thelengthproperty.- Parameters:
newLength- the newlengthproperty value
-
get
Returns the specified indexed property.- Specified by:
getin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getin classorg.htmlunit.corejs.javascript.ScriptableObject- Parameters:
index- the index of the propertystart- the scriptable object that was originally queried for this property- Returns:
- the property
-
put
Sets the index property.- Specified by:
putin interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
putin classorg.htmlunit.corejs.javascript.ScriptableObject- Parameters:
index- the indexstart- the scriptable object that was originally invoked for this propertynewValue- the new value
-
setValue
Selects the option with the specified value.- Overrides:
setValuein classHTMLElement- Parameters:
newValue- the value of the option to select
-
getSize
public int getSize()Returns thesizeattribute.- Returns:
- the
sizeattribute
-
setSize
-
isMultiple
public boolean isMultiple()Returnstrueif themultipleattribute is set.- Returns:
trueif themultipleattribute is set
-
setMultiple
public void setMultiple(boolean multiple) Sets or clears themultipleattribute.- Parameters:
multiple-trueto set themultipleattribute,falseto clear it
-
getLabels
Returns the labels associated with the element.- Returns:
- the labels associated with the element
-
isRequired
public boolean isRequired()Returns therequiredproperty.- Returns:
- the
requiredproperty
-
setRequired
public void setRequired(boolean required) Sets therequiredproperty.- Parameters:
required- the new value
-
getName
Returns the value of the JavaScript attributename.- Overrides:
getNamein classHTMLElement- Returns:
- the value of this attribute
-
setName
Sets the value of the JavaScript attributename.- Overrides:
setNamein classHTMLElement- Parameters:
newName- the new name
-
isDisabled
public boolean isDisabled()Returns true if this element is disabled. Overridden to modify browser configurations.- Overrides:
isDisabledin classHTMLElement- Returns:
- true if this element is disabled
-
setDisabled
public void setDisabled(boolean disabled) Sets whether or not to disable this element. Overridden to modify browser configurations.- Overrides:
setDisabledin classHTMLElement- Parameters:
disabled- True if this is to be disabled
-
getForm
Returns the value of the JavaScriptformattribute.- Overrides:
getFormin classHTMLElement- Returns:
- the value of the JavaScript
formattribute
-
checkValidity
public boolean checkValidity()Checks whether the element has any constraints and whether it satisfies them.- Returns:
- if the element is valid
-
getValidity
- Returns:
- a ValidityState with the validity states that this element is in.
-
getWillValidate
public boolean getWillValidate()- Returns:
- whether the element is a candidate for constraint validation
-
setCustomValidity
Sets the custom validity message for the element to the specified message.- Parameters:
message- the new message
-
iterator
public org.htmlunit.corejs.javascript.Scriptable iterator()
-