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 voidfocus()Sets the focus to this element.java.lang.StringgetCharset()Returns thecharsetattribute.java.lang.StringgetCoords()Returns thecoordsattribute.java.lang.ObjectgetDefaultValue(java.lang.Class<?> hint)Calls for instance for implicit conversion to string.(package private) static java.lang.StringgetDefaultValue(HtmlElement element)java.lang.StringgetDownload()Returns thedownloadattribute.java.lang.StringgetHash()Returns the hash portion of the link's URL (the portion following the '#', including the '#').java.lang.StringgetHost()Returns the host portion of the link's URL (the '[hostname]:[port]' portion).java.lang.StringgetHostname()Returns the hostname portion of the link's URL.java.lang.StringgetHref()Returns the value of this link'shrefproperty.java.lang.StringgetHreflang()Returns thehreflangattribute.java.lang.StringgetName()Returns the value of the name property of this link.java.lang.StringgetOrigin()Returns theoriginattribute.java.lang.StringgetPassword()Returns thepasswordattribute.java.lang.StringgetPathname()Returns the pathname portion of the link's URL.java.lang.StringgetPing()Returns thepingattribute.java.lang.StringgetPort()Returns the port portion of the link's URL.java.lang.StringgetProtocol()Returns the protocol portion of the link's URL, including the trailing ':'.java.lang.StringgetReferrerPolicy()Returns the value of the rev property.java.lang.StringgetRel()Returns the value of the rel property.DOMTokenListgetRelList()Returns therelListattribute.java.lang.StringgetRev()Returns the value of the rev property.java.lang.StringgetSearch()Returns the search portion of the link's URL (the portion starting with '?' and up to but not including any '#').java.lang.StringgetShape()Returns theshapeattribute.java.lang.StringgetTarget()Returns the value of the target property of this link.java.lang.StringgetText()Returns thetextattribute.java.lang.StringgetType()Returns thetypeattribute.private java.net.URLgetUrl()Returns this link's current URL.java.lang.StringgetUsername()Returns theusernameattribute.voidjsConstructor()JavaScript constructor.voidsetCharset(java.lang.String charset)Sets thecharsetattribute.voidsetCoords(java.lang.String coords)Sets thecoordsattribute.voidsetDownload(java.lang.String download)Sets thedownloadattribute.voidsetHash(java.lang.String hash)Sets the hash portion of the link's URL (the portion following the '#').voidsetHost(java.lang.String host)Sets the host portion of the link's URL (the '[hostname]:[port]' portion).voidsetHostname(java.lang.String hostname)Sets the hostname portion of the link's URL.voidsetHref(java.lang.String href)Sets thehrefproperty.voidsetHreflang(java.lang.String hreflang)Sets thehreflangattribute.voidsetName(java.lang.String name)Sets the name property.voidsetPassword(java.lang.String password)Sets thepasswordattribute.voidsetPathname(java.lang.String pathname)Sets the pathname portion of the link's URL.voidsetPing(java.lang.String ping)Sets thepingattribute.voidsetPort(java.lang.String port)Sets the port portion of the link's URL.voidsetProtocol(java.lang.String protocol)Sets the protocol portion of the link's URL.voidsetReferrerPolicy(java.lang.String referrerPolicy)Sets the rev property.voidsetRel(java.lang.String rel)Sets the rel property.voidsetRelList(java.lang.Object rel)Sets the relList property.voidsetRev(java.lang.String rel)Sets the rev property.voidsetSearch(java.lang.String search)Sets the search portion of the link's URL (the portion starting with '?' and up to but not including any '#')..voidsetShape(java.lang.String shape)Sets theshapeattribute.voidsetTarget(java.lang.String target)Sets the target property of this link.voidsetText(java.lang.String text)Sets thetextattribute.voidsetType(java.lang.String type)Sets thetypeattribute.private voidsetUrl(java.net.URL url)Sets thehrefattribute of this link to the specified URL.voidsetUsername(java.lang.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, 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:
jsConstructorin classHTMLElement
-
setHref
public void setHref(java.lang.String href)
Sets thehrefproperty.- Parameters:
href- thehrefproperty value
-
getHref
public java.lang.String 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
public void setName(java.lang.String name)
Sets the name property.- Overrides:
setNamein classHTMLElement- Parameters:
name- name attribute value
-
getName
public java.lang.String getName()
Returns the value of the name property of this link.- Overrides:
getNamein 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.MalformedURLExceptionReturns 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 thehrefattribute of this link to the specified URL.- Parameters:
url- the new value of thehrefattribute
-
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.ExceptionSets 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.ExceptionSets 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.ExceptionSets 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.ExceptionSets 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.ExceptionSets 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.ExceptionSets 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.ExceptionSets 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:
getDefaultValuein interfaceorg.htmlunit.corejs.javascript.Scriptable- Overrides:
getDefaultValuein 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 thetextattribute.- Returns:
- the
textattribute
-
setText
public void setText(java.lang.String text)
Sets thetextattribute.- Parameters:
text- thetextattribute
-
getCharset
public java.lang.String getCharset()
Returns thecharsetattribute.- Returns:
- the
charsetattribute
-
setCharset
public void setCharset(java.lang.String charset)
Sets thecharsetattribute.- Parameters:
charset- thecharsetattribute
-
getCoords
public java.lang.String getCoords()
Returns thecoordsattribute.- Returns:
- the
coordsattribute
-
setCoords
public void setCoords(java.lang.String coords)
Sets thecoordsattribute.- Parameters:
coords-coordsattribute
-
getHreflang
public java.lang.String getHreflang()
Returns thehreflangattribute.- Returns:
- the
hreflangattribute
-
setHreflang
public void setHreflang(java.lang.String hreflang)
Sets thehreflangattribute.- Parameters:
hreflang-hreflangattribute
-
getOrigin
public java.lang.String getOrigin()
Returns theoriginattribute.- Returns:
- the
originattribute
-
getUsername
public java.lang.String getUsername()
Returns theusernameattribute.- Returns:
- the
usernameattribute
-
setUsername
public void setUsername(java.lang.String username)
Sets theusernameattribute.- Parameters:
username-usernameattribute
-
getPassword
public java.lang.String getPassword()
Returns thepasswordattribute.- Returns:
- the
passwordattribute
-
setPassword
public void setPassword(java.lang.String password)
Sets thepasswordattribute.- Parameters:
password-passwordattribute
-
getDownload
public java.lang.String getDownload()
Returns thedownloadattribute.- Returns:
- the
downloadattribute
-
setDownload
public void setDownload(java.lang.String download)
Sets thedownloadattribute.- Parameters:
download-downloadattribute
-
getPing
public java.lang.String getPing()
Returns thepingattribute.- Returns:
- the
pingattribute
-
setPing
public void setPing(java.lang.String ping)
Sets thepingattribute.- Parameters:
ping-pingattribute
-
getShape
public java.lang.String getShape()
Returns theshapeattribute.- Returns:
- the
shapeattribute
-
setShape
public void setShape(java.lang.String shape)
Sets theshapeattribute.- Parameters:
shape-shapeattribute
-
getType
public java.lang.String getType()
Returns thetypeattribute.- Returns:
- the
typeattribute
-
setType
public void setType(java.lang.String type)
Sets thetypeattribute.- Parameters:
type-typeattribute
-
getRelList
public DOMTokenList getRelList()
Returns therelListattribute.- Returns:
- the
relListattribute
-
setRelList
public void setRelList(java.lang.Object rel)
Sets the relList property.- Parameters:
rel- attribute value
-
-