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.ProxyDomNodeNested 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_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 TypeMethodDescriptionvoidfocus()Sets the focus to this element.Returns thecharsetattribute.Returns thecoordsattribute.getDefaultValue(Class<?> hint) Calls for instance for implicit conversion to string.(package private) static StringgetDefaultValue(HtmlElement element) Returns thedownloadattribute.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'shrefproperty.Returns thehreflangattribute.getName()Returns the value of the name property of this link.Returns theoriginattribute.Returns thepasswordattribute.Returns the pathname portion of the link's URL.getPing()Returns thepingattribute.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 therelListattribute.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 theshapeattribute.Returns the value of the target property of this link.getText()Returns thetextattribute.getType()Returns thetypeattribute.private URLgetUrl()Returns this link's current URL.Returns theusernameattribute.voidJavaScript constructor.voidsetCharset(String charset) Sets thecharsetattribute.voidSets thecoordsattribute.voidsetDownload(String download) Sets thedownloadattribute.voidSets the hash portion of the link's URL (the portion following the '#').voidSets the host portion of the link's URL (the '[hostname]:[port]' portion).voidsetHostname(String hostname) Sets the hostname portion of the link's URL.voidSets thehrefproperty.voidsetHreflang(String hreflang) Sets thehreflangattribute.voidSets the name property.voidsetPassword(String password) Sets thepasswordattribute.voidsetPathname(String pathname) Sets the pathname portion of the link's URL.voidSets thepingattribute.voidSets the port portion of the link's URL.voidsetProtocol(String protocol) Sets the protocol portion of the link's URL.voidsetReferrerPolicy(String referrerPolicy) Sets the rev property.voidSets the rel property.voidsetRelList(Object rel) Sets the relList property.voidSets the rev property.voidSets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..voidSets theshapeattribute.voidSets the target property of this link.voidSets thetextattribute.voidSets thetypeattribute.private voidSets thehrefattribute of this link to the specified URL.voidsetUsername(String username) Sets theusernameattribute.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, toStringMethods 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, webkitMatchesSelectorMethods 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, setNodeValueMethods inherited from class org.htmlunit.javascript.host.event.EventTarget
addEventListener, clearEventListenersContainer, dispatchEvent, executeEventLocally, fireEvent, getEventHandler, getEventListenersContainer, hasEventHandlers, isEventHandlerOnWindow, removeEventListener, setEventHandlerMethods 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, 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, 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:
jsConstructorin classHTMLElement
-
setHref
Sets thehrefproperty.- Parameters:
href- thehrefproperty value
-
getHref
Returns the value of this link'shrefproperty.- Returns:
- the value of this link's
hrefproperty
-
focus
public void focus()Sets the focus to this element.- Overrides:
focusin classHTMLElement
-
setName
Sets the name property.- Overrides:
setNamein classHTMLElement- Parameters:
name- name attribute value
-
getName
Returns the value of the name property of this link.- Overrides:
getNamein 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 thehrefattribute of this link to the specified URL.- Parameters:
url- the new value of thehrefattribute
-
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:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein classHtmlUnitScriptable- Parameters:
hint- the type hint- Returns:
- the default value
- See Also:
-
getDefaultValue
-
getText
Returns thetextattribute.- Returns:
- the
textattribute
-
setText
Sets thetextattribute.- Parameters:
text- thetextattribute
-
getCharset
Returns thecharsetattribute.- Returns:
- the
charsetattribute
-
setCharset
Sets thecharsetattribute.- Parameters:
charset- thecharsetattribute
-
getCoords
Returns thecoordsattribute.- Returns:
- the
coordsattribute
-
setCoords
Sets thecoordsattribute.- Parameters:
coords-coordsattribute
-
getHreflang
Returns thehreflangattribute.- Returns:
- the
hreflangattribute
-
setHreflang
Sets thehreflangattribute.- Parameters:
hreflang-hreflangattribute
-
getOrigin
Returns theoriginattribute.- Returns:
- the
originattribute
-
getUsername
Returns theusernameattribute.- Returns:
- the
usernameattribute
-
setUsername
Sets theusernameattribute.- Parameters:
username-usernameattribute
-
getPassword
Returns thepasswordattribute.- Returns:
- the
passwordattribute
-
setPassword
Sets thepasswordattribute.- Parameters:
password-passwordattribute
-
getDownload
Returns thedownloadattribute.- Returns:
- the
downloadattribute
-
setDownload
Sets thedownloadattribute.- Parameters:
download-downloadattribute
-
getPing
Returns thepingattribute.- Returns:
- the
pingattribute
-
setPing
Sets thepingattribute.- Parameters:
ping-pingattribute
-
getShape
Returns theshapeattribute.- Returns:
- the
shapeattribute
-
setShape
Sets theshapeattribute.- Parameters:
shape-shapeattribute
-
getType
Returns thetypeattribute.- Returns:
- the
typeattribute
-
setType
Sets thetypeattribute.- Parameters:
type-typeattribute
-
getRelList
Returns therelListattribute.- Returns:
- the
relListattribute
-
setRelList
Sets the relList property.- Parameters:
rel- attribute value
-