Class HTMLAnchorElement
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.HTMLAnchorElement
- 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
The JavaScript object that represents an anchor.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
Nested classes/interfaces inherited from class org.htmlunit.corejs.javascript.ScriptableObject
org.htmlunit.corejs.javascript.ScriptableObject.KeyComparator
-
Field Summary
FieldsFields inherited from class org.htmlunit.javascript.host.dom.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_NODE
Fields inherited from class org.htmlunit.corejs.javascript.ScriptableObject
CONST, DONTENUM, EMPTY, PERMANENT, READONLY, UNINITIALIZED_CONST
Fields inherited from interface org.htmlunit.corejs.javascript.Scriptable
NOT_FOUND
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
focus()
Sets the focus to this element.Returns thecharset
attribute.Returns thecoords
attribute.getDefaultValue
(Class<?> hint) Calls for instance for implicit conversion to string.(package private) static String
getDefaultValue
(HtmlElement element) Returns thedownload
attribute.getHash()
Returns the hash portion of the link's URL (the portion following the '#', including the '#').getHost()
Returns the host portion of the link's URL (the '[hostname]:[port]' portion).Returns the hostname portion of the link's URL.getHref()
Returns the value of this link'shref
property.Returns thehreflang
attribute.getName()
Returns the value of the name property of this link.Returns theorigin
attribute.Returns thepassword
attribute.Returns the pathname portion of the link's URL.getPing()
Returns theping
attribute.getPort()
Returns the port portion of the link's URL.Returns the protocol portion of the link's URL, including the trailing ':'.Returns the value of the rev property.getRel()
Returns the value of the rel property.Returns therelList
attribute.getRev()
Returns the value of the rev property.Returns the search portion of the link's URL (the portion starting with '?' and up to but not including any '#').getShape()
Returns theshape
attribute.Returns the value of the target property of this link.getText()
Returns thetext
attribute.getType()
Returns thetype
attribute.private URL
getUrl()
Returns this link's current URL.Returns theusername
attribute.void
JavaScript constructor.void
setCharset
(String charset) Sets thecharset
attribute.void
Sets thecoords
attribute.void
setDownload
(String download) Sets thedownload
attribute.void
Sets the hash portion of the link's URL (the portion following the '#').void
Sets the host portion of the link's URL (the '[hostname]:[port]' portion).void
setHostname
(String hostname) Sets the hostname portion of the link's URL.void
Sets thehref
property.void
setHreflang
(String hreflang) Sets thehreflang
attribute.void
Sets the name property.void
setPassword
(String password) Sets thepassword
attribute.void
setPathname
(String pathname) Sets the pathname portion of the link's URL.void
Sets theping
attribute.void
Sets the port portion of the link's URL.void
setProtocol
(String protocol) Sets the protocol portion of the link's URL.void
setReferrerPolicy
(String referrerPolicy) Sets the rev property.void
Sets the rel property.void
setRelList
(Object rel) Sets the relList property.void
Sets the rev property.void
Sets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..void
Sets theshape
attribute.void
Sets the target property of this link.void
Sets thetext
attribute.void
Sets thetype
attribute.private void
Sets thehref
attribute of this link to the specified URL.void
setUsername
(String username) Sets theusername
attribute.Methods inherited from class org.htmlunit.javascript.host.html.HTMLElement
blur, click, getAccessKey, getAlign, getAttributeNode, getAutofocus, getBoundingClientRect, getCh, getChOff, getContentEditable, getDataset, getDir, getDomNodeOrDie, getDomNodeOrNull, getEnterKeyHint, getForm, 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, getValue, getWidthOrHeight, isAncestorOfEventTarget, isDisabled, isEndTagForbidden, isHidden, isIsContentEditable, isLowerCaseInOuterHtml, isSpellcheck, setAccessKey, setAlign, setAttribute, setAutofocus, setCh, setChOff, setColorAttribute, setContentEditable, setDir, setDisabled, 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, setValue, setWidthOrHeight, toString
Methods inherited from class org.htmlunit.javascript.host.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, webkitMatchesSelector
Methods inherited from class org.htmlunit.javascript.host.dom.Node
after, append, appendChild, before, cloneNode, compareDocumentPosition, contains, getBaseURI, getChildNodes, getFirstChild, getJavaScriptNode, getLastChild, getNextSibling, getNodeType, getNodeValue, getOwnerDocument, getParent, getParentNode, getPreviousSibling, getRootNode, getTextContent, hasChildNodes, insertBefore, insertBeforeImpl, isEqualNode, isSameNode, normalize, prepend, removeChild, replaceChild, replaceChildren, replaceWith, setNodeValue
Methods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandler
Methods inherited from class org.htmlunit.javascript.HtmlUnitScriptable
clone, equivalentValues, get, getBrowserVersion, getClassName, getPrototype, getScriptableFor, getStartingScope, getWindow, getWindow, getWithPreemption, has, hasInstance, initParentScope, makeScriptableFor, put, setClassName, setDomNode, setParentScope, setupPromise, setupRejectedPromise
Methods 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, 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, put, putConst, putConstProperty, putProperty, putProperty, putProperty, querySlot, redefineProperty, sameValue, sealObject, setAttributes, setAttributes, setAttributes, setAttributes, setAttributes, setCommonDescriptorProperties, setExternalArrayData, setGetterOrSetter, setPrototype, size
-
Field Details
-
REFERRER_POLICIES
-
-
Constructor Details
-
HTMLAnchorElement
public HTMLAnchorElement()The constructor.
-
-
Method Details
-
jsConstructor
public void jsConstructor()JavaScript constructor.- Overrides:
jsConstructor
in classHTMLElement
-
setHref
Sets thehref
property.- Parameters:
href
- thehref
property value
-
getHref
Returns the value of this link'shref
property.- Returns:
- the value of this link's
href
property
-
focus
public void focus()Sets the focus to this element.- Overrides:
focus
in classHTMLElement
-
setName
Sets the name property.- Overrides:
setName
in classHTMLElement
- Parameters:
name
- name attribute value
-
getName
Returns the value of the name property of this link.- Overrides:
getName
in classHTMLElement
- Returns:
- the name property
-
setTarget
Sets the target property of this link.- Parameters:
target
- target attribute value
-
getTarget
Returns the value of the target property of this link.- Returns:
- the href property
-
getUrl
Returns this link's current URL.- Returns:
- this link's current URL
- Throws:
MalformedURLException
- if an error occurs
-
setUrl
Sets thehref
attribute of this link to the specified URL.- Parameters:
url
- the new value of thehref
attribute
-
setRel
Sets the rel property.- Parameters:
rel
- rel attribute value
-
getRel
Returns the value of the rel property.- Returns:
- the rel property
-
getRev
Returns the value of the rev property.- Returns:
- the rev property
-
setRev
Sets the rev property.- Parameters:
rel
- rev attribute value
-
getReferrerPolicy
Returns the value of the rev property.- Returns:
- the referrerPolicy property
-
setReferrerPolicy
Sets the rev property.- Parameters:
referrerPolicy
- referrerPolicy attribute value
-
getSearch
Returns the search portion of the link's URL (the portion starting with '?' and up to but not including any '#').- Returns:
- the search portion of the link's URL
- See Also:
-
setSearch
Sets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..- Parameters:
search
- the new search portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getHash
Returns the hash portion of the link's URL (the portion following the '#', including the '#').- Returns:
- the hash portion of the link's URL
- See Also:
-
setHash
Sets the hash portion of the link's URL (the portion following the '#').- Parameters:
hash
- the new hash portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getHost
Returns the host portion of the link's URL (the '[hostname]:[port]' portion).- Returns:
- the host portion of the link's URL
- See Also:
-
setHost
Sets the host portion of the link's URL (the '[hostname]:[port]' portion).- Parameters:
host
- the new host portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getHostname
Returns the hostname portion of the link's URL.- Returns:
- the hostname portion of the link's URL
- See Also:
-
setHostname
Sets the hostname portion of the link's URL.- Parameters:
hostname
- the new hostname portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getPathname
Returns the pathname portion of the link's URL.- Returns:
- the pathname portion of the link's URL
- See Also:
-
setPathname
Sets the pathname portion of the link's URL.- Parameters:
pathname
- the new pathname portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getPort
Returns the port portion of the link's URL.- Returns:
- the port portion of the link's URL
- See Also:
-
setPort
Sets the port portion of the link's URL.- Parameters:
port
- the new port portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getProtocol
Returns the protocol portion of the link's URL, including the trailing ':'.- Returns:
- the protocol portion of the link's URL, including the trailing ':'
- See Also:
-
setProtocol
Sets the protocol portion of the link's URL.- Parameters:
protocol
- the new protocol portion of the link's URL- Throws:
Exception
- if an error occurs- See Also:
-
getDefaultValue
Calls for instance for implicit conversion to string.- Specified by:
getDefaultValue
in interfaceorg.htmlunit.corejs.javascript.Scriptable
- Overrides:
getDefaultValue
in classHtmlUnitScriptable
- Parameters:
hint
- the type hint- Returns:
- the default value
- See Also:
-
getDefaultValue
-
getText
Returns thetext
attribute.- Returns:
- the
text
attribute
-
setText
Sets thetext
attribute.- Parameters:
text
- thetext
attribute
-
getCharset
Returns thecharset
attribute.- Returns:
- the
charset
attribute
-
setCharset
Sets thecharset
attribute.- Parameters:
charset
- thecharset
attribute
-
getCoords
Returns thecoords
attribute.- Returns:
- the
coords
attribute
-
setCoords
Sets thecoords
attribute.- Parameters:
coords
-coords
attribute
-
getHreflang
Returns thehreflang
attribute.- Returns:
- the
hreflang
attribute
-
setHreflang
Sets thehreflang
attribute.- Parameters:
hreflang
-hreflang
attribute
-
getOrigin
Returns theorigin
attribute.- Returns:
- the
origin
attribute
-
getUsername
Returns theusername
attribute.- Returns:
- the
username
attribute
-
setUsername
Sets theusername
attribute.- Parameters:
username
-username
attribute
-
getPassword
Returns thepassword
attribute.- Returns:
- the
password
attribute
-
setPassword
Sets thepassword
attribute.- Parameters:
password
-password
attribute
-
getDownload
Returns thedownload
attribute.- Returns:
- the
download
attribute
-
setDownload
Sets thedownload
attribute.- Parameters:
download
-download
attribute
-
getPing
Returns theping
attribute.- Returns:
- the
ping
attribute
-
setPing
Sets theping
attribute.- Parameters:
ping
-ping
attribute
-
getShape
Returns theshape
attribute.- Returns:
- the
shape
attribute
-
setShape
Sets theshape
attribute.- Parameters:
shape
-shape
attribute
-
getType
Returns thetype
attribute.- Returns:
- the
type
attribute
-
setType
Sets thetype
attribute.- Parameters:
type
-type
attribute
-
getRelList
Returns therelList
attribute.- Returns:
- the
relList
attribute
-
setRelList
Sets the relList property.- Parameters:
rel
- attribute value
-