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:
java.io.Serializable
,java.lang.Cloneable
,org.htmlunit.corejs.javascript.ConstProperties
,org.htmlunit.corejs.javascript.debug.DebuggableObject
,org.htmlunit.corejs.javascript.Scriptable
,org.htmlunit.corejs.javascript.SymbolScriptable
public class HTMLAnchorElement extends HTMLElement
The JavaScript object that represents an anchor.- See Also:
- Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.htmlunit.javascript.host.html.HTMLElement
HTMLElement.ProxyDomNode
-
-
Field Summary
Fields Modifier and Type Field Description private static java.util.List<java.lang.String>
REFERRER_POLICIES
-
Fields 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
-
-
Constructor Summary
Constructors Constructor Description HTMLAnchorElement()
The constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
focus()
Sets the focus to this element.java.lang.String
getCharset()
Returns thecharset
attribute.java.lang.String
getCoords()
Returns thecoords
attribute.java.lang.Object
getDefaultValue(java.lang.Class<?> hint)
Calls for instance for implicit conversion to string.(package private) static java.lang.String
getDefaultValue(HtmlElement element)
java.lang.String
getDownload()
Returns thedownload
attribute.java.lang.String
getHash()
Returns the hash portion of the link's URL (the portion following the '#', including the '#').java.lang.String
getHost()
Returns the host portion of the link's URL (the '[hostname]:[port]' portion).java.lang.String
getHostname()
Returns the hostname portion of the link's URL.java.lang.String
getHref()
Returns the value of this link'shref
property.java.lang.String
getHreflang()
Returns thehreflang
attribute.java.lang.String
getName()
Returns the value of the name property of this link.java.lang.String
getOrigin()
Returns theorigin
attribute.java.lang.String
getPassword()
Returns thepassword
attribute.java.lang.String
getPathname()
Returns the pathname portion of the link's URL.java.lang.String
getPing()
Returns theping
attribute.java.lang.String
getPort()
Returns the port portion of the link's URL.java.lang.String
getProtocol()
Returns the protocol portion of the link's URL, including the trailing ':'.java.lang.String
getReferrerPolicy()
Returns the value of the rev property.java.lang.String
getRel()
Returns the value of the rel property.DOMTokenList
getRelList()
Returns therelList
attribute.java.lang.String
getRev()
Returns the value of the rev property.java.lang.String
getSearch()
Returns the search portion of the link's URL (the portion starting with '?' and up to but not including any '#').java.lang.String
getShape()
Returns theshape
attribute.java.lang.String
getTarget()
Returns the value of the target property of this link.java.lang.String
getText()
Returns thetext
attribute.java.lang.String
getType()
Returns thetype
attribute.private java.net.URL
getUrl()
Returns this link's current URL.java.lang.String
getUsername()
Returns theusername
attribute.void
jsConstructor()
JavaScript constructor.void
setCharset(java.lang.String charset)
Sets thecharset
attribute.void
setCoords(java.lang.String coords)
Sets thecoords
attribute.void
setDownload(java.lang.String download)
Sets thedownload
attribute.void
setHash(java.lang.String hash)
Sets the hash portion of the link's URL (the portion following the '#').void
setHost(java.lang.String host)
Sets the host portion of the link's URL (the '[hostname]:[port]' portion).void
setHostname(java.lang.String hostname)
Sets the hostname portion of the link's URL.void
setHref(java.lang.String href)
Sets thehref
property.void
setHreflang(java.lang.String hreflang)
Sets thehreflang
attribute.void
setName(java.lang.String name)
Sets the name property.void
setPassword(java.lang.String password)
Sets thepassword
attribute.void
setPathname(java.lang.String pathname)
Sets the pathname portion of the link's URL.void
setPing(java.lang.String ping)
Sets theping
attribute.void
setPort(java.lang.String port)
Sets the port portion of the link's URL.void
setProtocol(java.lang.String protocol)
Sets the protocol portion of the link's URL.void
setReferrerPolicy(java.lang.String referrerPolicy)
Sets the rev property.void
setRel(java.lang.String rel)
Sets the rel property.void
setRelList(java.lang.Object rel)
Sets the relList property.void
setRev(java.lang.String rel)
Sets the rev property.void
setSearch(java.lang.String search)
Sets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..void
setShape(java.lang.String shape)
Sets theshape
attribute.void
setTarget(java.lang.String target)
Sets the target property of this link.void
setText(java.lang.String text)
Sets thetext
attribute.void
setType(java.lang.String type)
Sets thetype
attribute.private void
setUrl(java.net.URL url)
Sets thehref
attribute of this link to the specified URL.void
setUsername(java.lang.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
-
-
-
-
Method Detail
-
jsConstructor
public void jsConstructor()
JavaScript constructor.- Overrides:
jsConstructor
in classHTMLElement
-
setHref
public void setHref(java.lang.String href)
Sets thehref
property.- Parameters:
href
- thehref
property value
-
getHref
public java.lang.String 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
public void setName(java.lang.String name)
Sets the name property.- Overrides:
setName
in classHTMLElement
- Parameters:
name
- name attribute value
-
getName
public java.lang.String getName()
Returns the value of the name property of this link.- Overrides:
getName
in classHTMLElement
- Returns:
- the name property
-
setTarget
public void setTarget(java.lang.String target)
Sets the target property of this link.- Parameters:
target
- target attribute value
-
getTarget
public java.lang.String getTarget()
Returns the value of the target property of this link.- Returns:
- the href property
-
getUrl
private java.net.URL getUrl() throws java.net.MalformedURLException
Returns this link's current URL.- Returns:
- this link's current URL
- Throws:
java.net.MalformedURLException
- if an error occurs
-
setUrl
private void setUrl(java.net.URL url)
Sets thehref
attribute of this link to the specified URL.- Parameters:
url
- the new value of thehref
attribute
-
setRel
public void setRel(java.lang.String rel)
Sets the rel property.- Parameters:
rel
- rel attribute value
-
getRel
public java.lang.String getRel()
Returns the value of the rel property.- Returns:
- the rel property
-
getRev
public java.lang.String getRev()
Returns the value of the rev property.- Returns:
- the rev property
-
setRev
public void setRev(java.lang.String rel)
Sets the rev property.- Parameters:
rel
- rev attribute value
-
getReferrerPolicy
public java.lang.String getReferrerPolicy()
Returns the value of the rev property.- Returns:
- the referrerPolicy property
-
setReferrerPolicy
public void setReferrerPolicy(java.lang.String referrerPolicy)
Sets the rev property.- Parameters:
referrerPolicy
- referrerPolicy attribute value
-
getSearch
public java.lang.String 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:
- MSDN Documentation
-
setSearch
public void setSearch(java.lang.String search) throws java.lang.Exception
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:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getHash
public java.lang.String 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:
- MSDN Documentation
-
setHash
public void setHash(java.lang.String hash) throws java.lang.Exception
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:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getHost
public java.lang.String 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:
- MSDN Documentation
-
setHost
public void setHost(java.lang.String host) throws java.lang.Exception
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:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getHostname
public java.lang.String getHostname()
Returns the hostname portion of the link's URL.- Returns:
- the hostname portion of the link's URL
- See Also:
- MSDN Documentation
-
setHostname
public void setHostname(java.lang.String hostname) throws java.lang.Exception
Sets the hostname portion of the link's URL.- Parameters:
hostname
- the new hostname portion of the link's URL- Throws:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getPathname
public java.lang.String getPathname()
Returns the pathname portion of the link's URL.- Returns:
- the pathname portion of the link's URL
- See Also:
- MSDN Documentation
-
setPathname
public void setPathname(java.lang.String pathname) throws java.lang.Exception
Sets the pathname portion of the link's URL.- Parameters:
pathname
- the new pathname portion of the link's URL- Throws:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getPort
public java.lang.String getPort()
Returns the port portion of the link's URL.- Returns:
- the port portion of the link's URL
- See Also:
- MSDN Documentation
-
setPort
public void setPort(java.lang.String port) throws java.lang.Exception
Sets the port portion of the link's URL.- Parameters:
port
- the new port portion of the link's URL- Throws:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getProtocol
public java.lang.String 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:
- MSDN Documentation
-
setProtocol
public void setProtocol(java.lang.String protocol) throws java.lang.Exception
Sets the protocol portion of the link's URL.- Parameters:
protocol
- the new protocol portion of the link's URL- Throws:
java.lang.Exception
- if an error occurs- See Also:
- MSDN Documentation
-
getDefaultValue
public java.lang.Object getDefaultValue(java.lang.Class<?> hint)
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:
HtmlUnitScriptable.getDefaultValue(java.lang.Class)
-
getDefaultValue
static java.lang.String getDefaultValue(HtmlElement element)
-
getText
public java.lang.String getText()
Returns thetext
attribute.- Returns:
- the
text
attribute
-
setText
public void setText(java.lang.String text)
Sets thetext
attribute.- Parameters:
text
- thetext
attribute
-
getCharset
public java.lang.String getCharset()
Returns thecharset
attribute.- Returns:
- the
charset
attribute
-
setCharset
public void setCharset(java.lang.String charset)
Sets thecharset
attribute.- Parameters:
charset
- thecharset
attribute
-
getCoords
public java.lang.String getCoords()
Returns thecoords
attribute.- Returns:
- the
coords
attribute
-
setCoords
public void setCoords(java.lang.String coords)
Sets thecoords
attribute.- Parameters:
coords
-coords
attribute
-
getHreflang
public java.lang.String getHreflang()
Returns thehreflang
attribute.- Returns:
- the
hreflang
attribute
-
setHreflang
public void setHreflang(java.lang.String hreflang)
Sets thehreflang
attribute.- Parameters:
hreflang
-hreflang
attribute
-
getOrigin
public java.lang.String getOrigin()
Returns theorigin
attribute.- Returns:
- the
origin
attribute
-
getUsername
public java.lang.String getUsername()
Returns theusername
attribute.- Returns:
- the
username
attribute
-
setUsername
public void setUsername(java.lang.String username)
Sets theusername
attribute.- Parameters:
username
-username
attribute
-
getPassword
public java.lang.String getPassword()
Returns thepassword
attribute.- Returns:
- the
password
attribute
-
setPassword
public void setPassword(java.lang.String password)
Sets thepassword
attribute.- Parameters:
password
-password
attribute
-
getDownload
public java.lang.String getDownload()
Returns thedownload
attribute.- Returns:
- the
download
attribute
-
setDownload
public void setDownload(java.lang.String download)
Sets thedownload
attribute.- Parameters:
download
-download
attribute
-
getPing
public java.lang.String getPing()
Returns theping
attribute.- Returns:
- the
ping
attribute
-
setPing
public void setPing(java.lang.String ping)
Sets theping
attribute.- Parameters:
ping
-ping
attribute
-
getShape
public java.lang.String getShape()
Returns theshape
attribute.- Returns:
- the
shape
attribute
-
setShape
public void setShape(java.lang.String shape)
Sets theshape
attribute.- Parameters:
shape
-shape
attribute
-
getType
public java.lang.String getType()
Returns thetype
attribute.- Returns:
- the
type
attribute
-
setType
public void setType(java.lang.String type)
Sets thetype
attribute.- Parameters:
type
-type
attribute
-
getRelList
public DOMTokenList getRelList()
Returns therelList
attribute.- Returns:
- the
relList
attribute
-
setRelList
public void setRelList(java.lang.Object rel)
Sets the relList property.- Parameters:
rel
- attribute value
-
-