Class Element
- All Implemented Interfaces:
Cloneable
- Direct Known Subclasses:
Document, FormElement, PseudoTextElement
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate static final classprivate static final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Attributesprivate static final Stringprivate static final Patternprivate WeakReference<List<Element>> private TagFields inherited from class Node
EmptyNodes, EmptyString, parentNode, siblingIndex -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static voidaccumulateParents(Element el, Elements parents) Add a class name to this element'sclassattribute.Insert the specified node into the DOM after this node (as a following sibling).Insert the specified HTML into the DOM after this element (as a following sibling).Add inner HTML to this element.appendChild(Node child) Insert a node to the end of this Element's children.appendChildren(Collection<? extends Node> children) Insert the given nodes to the end of this Element's children.appendElement(String tagName) Create a new element by tag name, and add it as the last child.private static voidappendNormalisedText(StringBuilder accum, TextNode textNode) appendText(String text) Create and append a new TextNode to this element.Add this element to the supplied parent element, as its next child.private static voidappendWhitespaceIfBr(Element element, StringBuilder accum) Set a boolean attribute value on this element.Set an attribute value on this element.Get all of the element's attributes.baseUri()Get the base URI that applies to this node.Insert the specified node into the DOM before this node (as a preceding sibling).Insert the specified HTML into the DOM before this element (as a preceding sibling).child(int index) Get a child element of this element, by its 0-based index number.Maintains a shadow copy of this element's child elements.intGet the number of child nodes that this node holds.children()Get this element's child elements.intGet the number of child nodes of this element that are elements.Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated.Get all of the element's class names.classNames(Set<String> classNames) Set the element'sclassattribute to the supplied class names.Clear (remove) all of the attributes in this node.clone()Create a stand-alone, deep copy of this node, and all of its children.Find the closest element up the tree of parents that matches the specified evaluator.Find the closest element up the tree of parents that matches the specified CSS query.Get a CSS selector that will uniquely select this element.data()Get the combined data of this element.Get this element's child data nodes.dataset()Get this element's HTML5 custom data attributes.protected Nodeprotected voiddoSetBaseUri(String baseUri) Set the baseUri for just this node (not its descendants), if this Node tracks base URIs.intGet the list index of this element in its element sibling list.empty()Remove all of the element's child nodes.filter(NodeFilter nodeFilter) Perform a depth-first filtering through this node and its descendants.Gets the first Element sibling of this element.Find all elements under this element (including self, and children of children).getElementById(String id) Find an element by ID, including or under this element.Find elements that have a named attribute set.getElementsByAttributeStarting(String keyPrefix) Find elements that have an attribute name starting with the supplied prefix.getElementsByAttributeValue(String key, String value) Find elements that have an attribute with the specific value.getElementsByAttributeValueContaining(String key, String match) Find elements that have attributes whose value contains the match string.getElementsByAttributeValueEnding(String key, String valueSuffix) Find elements that have attributes that end with the value suffix.getElementsByAttributeValueMatching(String key, String regex) Find elements that have attributes whose values match the supplied regular expression.getElementsByAttributeValueMatching(String key, Pattern pattern) Find elements that have attributes whose values match the supplied regular expression.getElementsByAttributeValueNot(String key, String value) Find elements that either do not have this attribute, or have it with a different value.getElementsByAttributeValueStarting(String key, String valuePrefix) Find elements that have attributes that start with the value prefix.getElementsByClass(String className) Find elements that have this class, including or under this element.getElementsByIndexEquals(int index) Find elements whose sibling index is equal to the supplied index.getElementsByIndexGreaterThan(int index) Find elements whose sibling index is greater than the supplied index.getElementsByIndexLessThan(int index) Find elements whose sibling index is less than the supplied index.getElementsByTag(String tagName) Finds elements, including and recursively under this element, with the specified tag name.getElementsContainingOwnText(String searchText) Find elements that directly contain the specified string.getElementsContainingText(String searchText) Find elements that contain the specified string.getElementsMatchingOwnText(String regex) Find elements whose own text matches the supplied regular expression.getElementsMatchingOwnText(Pattern pattern) Find elements whose own text matches the supplied regular expression.getElementsMatchingText(String regex) Find elements whose text matches the supplied regular expression.getElementsMatchingText(Pattern pattern) Find elements whose text matches the supplied regular expression.protected booleanCheck if this Node has an actual Attributes object.protected booleanInternal test to check if a nodelist object has been created.booleanTests if this element has a class.booleanhasText()Test if this element has any text content (that is not just whitespace).html()Retrieves the element's inner HTML.html(Appendable appendable) Write this node and its children to the givenAppendable.Set this element's inner HTML.id()Get theidattribute of this element.Set theidattribute of this element.private static <E extends Element>
intindexInList(Element search, List<E> elements) insertChild(int index, Node child) Inserts the given child node into this element at the specified index.insertChildren(int index, Node... children) Inserts the given child nodes into this element at the specified index.insertChildren(int index, Collection<? extends Node> children) Inserts the given child nodes into this element at the specified index.booleanCheck if this element matches the given evaluator.booleanChecks if this element matches the givenSelectorCSS query.booleanisBlock()Test if this element is a block-level element.private booleanprivate booleanGets the last element sibling of this element.Gets the next sibling element of this element.Get each of the sibling elements that come after this element.private ElementsnextElementSiblings(boolean next) (package private) voidClears the cached shadow child elements.nodeName()Get the node name of this node.Get the normalized name of this Element's tag.(package private) voidouterHtmlHead(Appendable accum, int depth, Document.OutputSettings out) Get the outer HTML of this node.(package private) voidouterHtmlTail(Appendable accum, int depth, Document.OutputSettings out) ownText()Gets the (normalized) text owned by this element only; does not get the combined text of all children.private voidownText(StringBuilder accum) final Nodeparent()Gets this node's parent node.parents()Get this element's parent and ancestors, up to the document root.Add inner HTML into this element.prependChild(Node child) Add a node to the start of this element's children.prependChildren(Collection<? extends Node> children) Insert the given nodes to the start of this Element's children.prependElement(String tagName) Create a new element by tag name, and add it as the first child.prependText(String text) Create and prepend a new TextNode to this element.(package private) static booleanpreserveWhitespace(Node node) Gets the previous element sibling of this element.Get each of the element siblings before this element.removeAttr(String attributeKey) Remove an attribute from this node.removeClass(String className) Remove a class name from this element'sclassattribute.root()Get this node's root node; that is, its topmost ancestor.private static StringsearchUpForAttribute(Element start, String key) Find elements that match the supplied Evaluator.Find elements that match theSelectorCSS query, with this element as the starting context.selectFirst(Evaluator evaluator) Finds the first Element that matches the supplied Evaluator, with this element as the starting context, ornullif none match.selectFirst(String cssQuery) Find the first Element that matches theSelectorCSS query, with this element as the starting context.Create a stand-alone, shallow copy of this node.Get sibling elements.tag()Get the Tag for this element.tagName()Get the name of the tag for this element.Change (rename) the tag of this element.text()Gets the normalized, combined text of this element and all its children.Set the text of this element.Get this element's child text nodes.toggleClass(String className) Toggle a class name on this element'sclassattribute: if present, remove it; otherwise add it.traverse(NodeVisitor nodeVisitor) Perform a depth-first traversal through this node and its descendants.val()Get the value of a form element (input, textarea, etc).Set the value of a form element (input, textarea, etc).Get the (unencoded) text of all children of this element, including any newlines and spaces present in the original.Wrap the supplied HTML around this element.Methods inherited from class Node
absUrl, addChildren, addChildren, attr, childNode, childNodes, childNodesAsArray, childNodesCopy, equals, hasAttr, hasParent, hasSameValue, indent, nextSibling, outerHtml, outerHtml, ownerDocument, parentNode, previousSibling, remove, removeChild, reparentChild, replaceChild, replaceWith, setBaseUri, setParentNode, setSiblingIndex, siblingIndex, siblingNodes, toString, unwrap
-
Field Details
-
EmptyChildren
-
ClassSplit
-
BaseUriKey
-
tag
-
shadowChildrenRef
-
childNodes
-
attributes
-
-
Constructor Details
-
Element
-
Element
Create a new, standalone Element. (Standalone in that is has no parent.)- Parameters:
tag- tag of this elementbaseUri- the base URI (optional, may be null to inherit from parent, or "" to clear parent's)attributes- initial attributes (optional, may be null)- See Also:
-
Element
-
-
Method Details
-
hasChildNodes
protected boolean hasChildNodes()Internal test to check if a nodelist object has been created. -
ensureChildNodes
- Specified by:
ensureChildNodesin classNode
-
hasAttributes
protected boolean hasAttributes()Description copied from class:NodeCheck if this Node has an actual Attributes object.- Specified by:
hasAttributesin classNode
-
attributes
Description copied from class:NodeGet all of the element's attributes.- Specified by:
attributesin classNode- Returns:
- attributes (which implements iterable, in same order as presented in original HTML).
-
baseUri
-
searchUpForAttribute
-
doSetBaseUri
Description copied from class:NodeSet the baseUri for just this node (not its descendants), if this Node tracks base URIs.- Specified by:
doSetBaseUriin classNode- Parameters:
baseUri- new URI
-
childNodeSize
public int childNodeSize()Description copied from class:NodeGet the number of child nodes that this node holds.- Specified by:
childNodeSizein classNode- Returns:
- the number of child nodes that this node holds.
-
nodeName
-
tagName
Get the name of the tag for this element. E.g.div. If you are usingcase preserving parsing, this will return the source's original case.- Returns:
- the tag name
-
normalName
Get the normalized name of this Element's tag. This will always be the lowercased version of the tag, regardless of the tag case preserving setting of the parser. For e.g.,<DIV>and<div>both have a normal name ofdiv.- Returns:
- normal name
-
tagName
-
tag
-
isBlock
public boolean isBlock()Test if this element is a block-level element. (E.g.<div> == trueor an inline element<span> == false).- Returns:
- true if block, false if not (and thus inline)
-
id
Get theidattribute of this element.- Returns:
- The id attribute, if present, or an empty string if not.
-
id
-
attr
Set an attribute value on this element. If this element already has an attribute with the key, its value is updated; otherwise, a new attribute is added. -
attr
Set a boolean attribute value on this element. Setting totruesets the attribute value to "" and marks the attribute as boolean so no value is written out. Setting tofalseremoves the attribute with the same key if it exists.- Parameters:
attributeKey- the attribute keyattributeValue- the attribute value- Returns:
- this element
-
dataset
Get this element's HTML5 custom data attributes. Each attribute in the element that has a key starting with "data-" is included the dataset.E.g., the element
<div data-package="jsoup" data-language="Java" class="group">...has the datasetpackage=jsoup, language=java.This map is a filtered view of the element's attribute map. Changes to one map (add, remove, update) are reflected in the other map.
You can find elements that have data attributes using the
[^data-]attribute key prefix selector.- Returns:
- a map of
key=valuecustom data attributes.
-
parent
-
parents
Get this element's parent and ancestors, up to the document root.- Returns:
- this element's stack of parents, closest first.
-
accumulateParents
-
child
Get a child element of this element, by its 0-based index number.Note that an element can have both mixed Nodes and Elements as children. This method inspects a filtered list of children that are elements, and the index is based on that filtered list.
- Parameters:
index- the index number of the element to retrieve- Returns:
- the child element, if it exists, otherwise throws an
IndexOutOfBoundsException - See Also:
-
childrenSize
public int childrenSize()Get the number of child nodes of this element that are elements.This method works on the same filtered list like
child(int). UseNode.childNodes()andchildNodeSize()to get the unfiltered Nodes (e.g. includes TextNodes etc.)- Returns:
- the number of child nodes that are elements
- See Also:
-
children
Get this element's child elements.This is effectively a filter on
Node.childNodes()to get Element nodes.- Returns:
- child elements. If this element has no children, returns an empty list.
- See Also:
-
childElementsList
-
nodelistChanged
void nodelistChanged()Clears the cached shadow child elements.- Overrides:
nodelistChangedin classNode
-
textNodes
Get this element's child text nodes. The list is unmodifiable but the text nodes may be manipulated.This is effectively a filter on
Node.childNodes()to get Text nodes.- Returns:
- child text nodes. If this element has no text nodes, returns an
empty list.
For example, with the input HTML:
<p>One <span>Two</span> Three <br> Four</p>with thepelement selected:p.text()="One Two Three Four"p.ownText()="One Three Four"p.children()=Elements[<span>, <br>]p.childNodes()=List<Node>["One ", <span>, " Three ", <br>, " Four"]p.textNodes()=List<TextNode>["One ", " Three ", " Four"]
-
dataNodes
Get this element's child data nodes. The list is unmodifiable but the data nodes may be manipulated.This is effectively a filter on
Node.childNodes()to get Data nodes.- Returns:
- child data nodes. If this element has no data nodes, returns an empty list.
- See Also:
-
select
Find elements that match theSelectorCSS query, with this element as the starting context. Matched elements may include this element, or any of its children.This method is generally more powerful to use than the DOM-type
getElementBy*methods, because multiple filters can be combined, e.g.:el.select("a[href]")- finds links (atags withhrefattributes)el.select("a[href*=example.com]")- finds links pointing to example.com (loosely)
See the query syntax documentation in
Selector.Also known as
querySelectorAll()in the Web DOM.- Parameters:
cssQuery- aSelectorCSS-like query- Returns:
- an
Elementslist containing elements that match the query (empty if none match) - Throws:
Selector.SelectorParseException- (unchecked) on an invalid CSS query.- See Also:
-
select
Find elements that match the supplied Evaluator. This has the same functionality asselect(String), but may be useful if you are running the same query many times (on many documents) and want to save the overhead of repeatedly parsing the CSS query.- Parameters:
evaluator- an element evaluator- Returns:
- an
Elementslist containing elements that match the query (empty if none match)
-
selectFirst
Find the first Element that matches theSelectorCSS query, with this element as the starting context.This is effectively the same as calling
element.select(query).first(), but is more efficient as query execution stops on the first hit.Also known as
querySelector()in the Web DOM.- Parameters:
cssQuery- cssQuery aSelectorCSS-like query- Returns:
- the first matching element, or
nullif there is no match.
-
selectFirst
Finds the first Element that matches the supplied Evaluator, with this element as the starting context, ornullif none match.- Parameters:
evaluator- an element evaluator- Returns:
- the first matching element (walking down the tree, starting from this element), or
nullif none matchn.
-
is
-
is
Check if this element matches the given evaluator.- Parameters:
evaluator- an element evaluator- Returns:
- if this element matches
-
closest
Find the closest element up the tree of parents that matches the specified CSS query. Will return itself, an ancestor, ornullif there is no such matching element.- Parameters:
cssQuery- aSelectorCSS query- Returns:
- the closest ancestor element (possibly itself) that matches the provided evaluator.
nullif not found.
-
closest
Find the closest element up the tree of parents that matches the specified evaluator. Will return itself, an ancestor, ornullif there is no such matching element.- Parameters:
evaluator- a query evaluator- Returns:
- the closest ancestor element (possibly itself) that matches the provided evaluator.
nullif not found.
-
appendChild
-
appendChildren
Insert the given nodes to the end of this Element's children.- Parameters:
children- nodes to add- Returns:
- this Element, for chaining
- See Also:
-
appendTo
-
prependChild
-
prependChildren
Insert the given nodes to the start of this Element's children.- Parameters:
children- nodes to add- Returns:
- this Element, for chaining
- See Also:
-
insertChildren
Inserts the given child nodes into this element at the specified index. Current nodes will be shifted to the right. The inserted nodes will be moved from their current parent. To prevent moving, copy the nodes first.- Parameters:
index- 0-based index to insert children at. Specify0to insert at the start,-1at the endchildren- child nodes to insert- Returns:
- this element, for chaining.
-
insertChildren
Inserts the given child nodes into this element at the specified index. Current nodes will be shifted to the right. The inserted nodes will be moved from their current parent. To prevent moving, copy the nodes first.- Parameters:
index- 0-based index to insert children at. Specify0to insert at the start,-1at the endchildren- child nodes to insert- Returns:
- this element, for chaining.
-
insertChild
Inserts the given child node into this element at the specified index. Current node will be shifted to the right. The inserted nodes will be moved from their current parent. To prevent moving, copy the node first.- Parameters:
index- 0-based index to insert children at. Specify0to insert at the start,-1at the endchild- child node to insert- Returns:
- this element, for chaining.
-
appendElement
-
prependElement
-
appendText
-
prependText
-
append
-
prepend
-
before
-
before
-
after
-
after
-
empty
-
wrap
-
cssSelector
Get a CSS selector that will uniquely select this element.If the element has an ID, returns #id; otherwise returns the parent (if any) CSS selector, followed by '>', followed by a unique selector for the element (tag.class.class:nth-child(n)).
- Returns:
- the CSS Path that can be used to retrieve the element in a selector.
-
siblingElements
Get sibling elements. If the element has no sibling elements, returns an empty list. An element is not a sibling of itself, so will not be included in the returned list.- Returns:
- sibling elements
-
nextElementSibling
Gets the next sibling element of this element. E.g., if adivcontains twops, thenextElementSiblingof the firstpis the secondp.This is similar to
Node.nextSibling(), but specifically finds only Elements- Returns:
- the next element, or null if there is no next element
- See Also:
-
nextElementSiblings
Get each of the sibling elements that come after this element.- Returns:
- each of the element siblings after this element, or an empty list if there are no next sibling elements
-
previousElementSibling
Gets the previous element sibling of this element.- Returns:
- the previous element, or null if there is no previous element
- See Also:
-
previousElementSiblings
Get each of the element siblings before this element.- Returns:
- the previous element siblings, or an empty list if there are none.
-
nextElementSiblings
-
firstElementSibling
Gets the first Element sibling of this element. That may be this element.- Returns:
- the first sibling that is an element (aka the parent's first element child)
-
elementSiblingIndex
public int elementSiblingIndex()Get the list index of this element in its element sibling list. I.e. if this is the first element sibling, returns 0.- Returns:
- position in element sibling list
-
lastElementSibling
Gets the last element sibling of this element. That may be this element.- Returns:
- the last sibling that is an element (aka the parent's last element child)
-
indexInList
-
getElementsByTag
Finds elements, including and recursively under this element, with the specified tag name.- Parameters:
tagName- The tag name to search for (case insensitively).- Returns:
- a matching unmodifiable list of elements. Will be empty if this element and none of its children match.
-
getElementById
Find an element by ID, including or under this element.Note that this finds the first matching ID, starting with this element. If you search down from a different starting point, it is possible to find a different element by ID. For unique element by ID within a Document, use
getElementById(String)- Parameters:
id- The ID to search for.- Returns:
- The first matching element by ID, starting with this element, or null if none found.
-
getElementsByClass
Find elements that have this class, including or under this element. Case insensitive.Elements can have multiple classes (e.g.
<div class="header round first">. This method checks each class, so you can find the above withel.getElementsByClass("header");.- Parameters:
className- the name of the class to search for.- Returns:
- elements with the supplied class name, empty if none
- See Also:
-
getElementsByAttribute
-
getElementsByAttributeStarting
Find elements that have an attribute name starting with the supplied prefix. Usedata-to find elements that have HTML5 datasets.- Parameters:
keyPrefix- name prefix of the attribute e.g.data-- Returns:
- elements that have attribute names that start with with the prefix, empty if none.
-
getElementsByAttributeValue
-
getElementsByAttributeValueNot
Find elements that either do not have this attribute, or have it with a different value. Case insensitive.- Parameters:
key- name of the attributevalue- value of the attribute- Returns:
- elements that do not have a matching attribute
-
getElementsByAttributeValueStarting
Find elements that have attributes that start with the value prefix. Case insensitive.- Parameters:
key- name of the attributevaluePrefix- start of attribute value- Returns:
- elements that have attributes that start with the value prefix
-
getElementsByAttributeValueEnding
Find elements that have attributes that end with the value suffix. Case insensitive.- Parameters:
key- name of the attributevalueSuffix- end of the attribute value- Returns:
- elements that have attributes that end with the value suffix
-
getElementsByAttributeValueContaining
Find elements that have attributes whose value contains the match string. Case insensitive.- Parameters:
key- name of the attributematch- substring of value to search for- Returns:
- elements that have attributes containing this text
-
getElementsByAttributeValueMatching
Find elements that have attributes whose values match the supplied regular expression.- Parameters:
key- name of the attributepattern- compiled regular expression to match against attribute values- Returns:
- elements that have attributes matching this regular expression
-
getElementsByAttributeValueMatching
Find elements that have attributes whose values match the supplied regular expression.- Parameters:
key- name of the attributeregex- regular expression to match against attribute values. You can use embedded flags (such as (?i) and (?m) to control regex options.- Returns:
- elements that have attributes matching this regular expression
-
getElementsByIndexLessThan
Find elements whose sibling index is less than the supplied index.- Parameters:
index- 0-based index- Returns:
- elements less than index
-
getElementsByIndexGreaterThan
Find elements whose sibling index is greater than the supplied index.- Parameters:
index- 0-based index- Returns:
- elements greater than index
-
getElementsByIndexEquals
Find elements whose sibling index is equal to the supplied index.- Parameters:
index- 0-based index- Returns:
- elements equal to index
-
getElementsContainingText
Find elements that contain the specified string. The search is case insensitive. The text may appear directly in the element, or in any of its descendants.- Parameters:
searchText- to look for in the element's text- Returns:
- elements that contain the string, case insensitive.
- See Also:
-
getElementsContainingOwnText
Find elements that directly contain the specified string. The search is case insensitive. The text must appear directly in the element, not in any of its descendants.- Parameters:
searchText- to look for in the element's own text- Returns:
- elements that contain the string, case insensitive.
- See Also:
-
getElementsMatchingText
-
getElementsMatchingText
Find elements whose text matches the supplied regular expression.- Parameters:
regex- regular expression to match text against. You can use embedded flags (such as (?i) and (?m) to control regex options.- Returns:
- elements matching the supplied regular expression.
- See Also:
-
getElementsMatchingOwnText
-
getElementsMatchingOwnText
Find elements whose own text matches the supplied regular expression.- Parameters:
regex- regular expression to match text against. You can use embedded flags (such as (?i) and (?m) to control regex options.- Returns:
- elements matching the supplied regular expression.
- See Also:
-
getAllElements
Find all elements under this element (including self, and children of children).- Returns:
- all elements
-
text
Gets the normalized, combined text of this element and all its children. Whitespace is normalized and trimmed.For example, given HTML
<p>Hello <b>there</b> now! </p>,p.text()returns"Hello there now!"If you do not want normalized text, use
wholeText(). If you want just the text of this node (and not children), useownText()Note that this method returns the textual content that would be presented to a reader. The contents of data nodes (such as
<script>tags are not considered text. Usedata()orhtml()to retrieve that content.- Returns:
- unencoded, normalized text, or empty string if none.
- See Also:
-
wholeText
Get the (unencoded) text of all children of this element, including any newlines and spaces present in the original.- Returns:
- unencoded, un-normalized text
- See Also:
-
ownText
Gets the (normalized) text owned by this element only; does not get the combined text of all children.For example, given HTML
<p>Hello <b>there</b> now!</p>,p.ownText()returns"Hello now!", whereasp.text()returns"Hello there now!". Note that the text within thebelement is not returned, as it is not a direct child of thepelement.- Returns:
- unencoded text, or empty string if none.
- See Also:
-
ownText
-
appendNormalisedText
-
appendWhitespaceIfBr
-
preserveWhitespace
-
text
-
hasText
public boolean hasText()Test if this element has any text content (that is not just whitespace).- Returns:
- true if element has non-blank text content.
-
data
Get the combined data of this element. Data is e.g. the inside of a<script>tag. Note that data is NOT the text of the element. Usetext()to get the text that would be visible to a user, anddata()for the contents of scripts, comments, CSS styles, etc.- Returns:
- the data, or empty string if none
- See Also:
-
className
Gets the literal value of this element's "class" attribute, which may include multiple class names, space separated. (E.g. on<div class="header gray">returns, "header gray")- Returns:
- The literal class attribute, or empty string if no class attribute set.
-
classNames
Get all of the element's class names. E.g. on element<div class="header gray">, returns a set of two elements"header", "gray". Note that modifications to this set are not pushed to the backingclassattribute; use theclassNames(java.util.Set)method to persist them.- Returns:
- set of classnames, empty if no class attribute
-
classNames
-
hasClass
Tests if this element has a class. Case insensitive.- Parameters:
className- name of class to check for- Returns:
- true if it does, false if not
-
addClass
-
removeClass
-
toggleClass
-
val
Get the value of a form element (input, textarea, etc).- Returns:
- the value of the form element, or empty string if not set.
-
val
-
outerHtmlHead
Description copied from class:NodeGet the outer HTML of this node.- Specified by:
outerHtmlHeadin classNode- Parameters:
accum- accumulator to place HTML into- Throws:
IOException- if appending to the given accumulator fails.
-
outerHtmlTail
- Specified by:
outerHtmlTailin classNode- Throws:
IOException
-
html
Retrieves the element's inner HTML. E.g. on a<div>with one empty<p>, would return<p></p>. (WhereasNode.outerHtml()would return<div><p></p></div>.)- Returns:
- String of HTML.
- See Also:
-
html
Description copied from class:NodeWrite this node and its children to the givenAppendable.- Overrides:
htmlin classNode- Parameters:
appendable- theAppendableto write to.- Returns:
- the supplied
Appendable, for chaining.
-
html
-
clone
Description copied from class:NodeCreate a stand-alone, deep copy of this node, and all of its children. The cloned node will have no siblings or parent node. As a stand-alone object, any changes made to the clone or any of its children will not impact the original node.The cloned node may be adopted into another Document or node structure using
appendChild(Node). -
shallowClone
Description copied from class:NodeCreate a stand-alone, shallow copy of this node. None of its children (if any) will be cloned, and it will have no parent or sibling nodes.- Overrides:
shallowClonein classNode- Returns:
- a single independent copy of this node
- See Also:
-
doClone
-
clearAttributes
Description copied from class:NodeClear (remove) all of the attributes in this node.- Overrides:
clearAttributesin classNode- Returns:
- this, for chaining
-
removeAttr
Description copied from class:NodeRemove an attribute from this node.- Overrides:
removeAttrin classNode- Parameters:
attributeKey- The attribute to remove.- Returns:
- this (for chaining)
-
root
-
traverse
Description copied from class:NodePerform a depth-first traversal through this node and its descendants. -
filter
Description copied from class:NodePerform a depth-first filtering through this node and its descendants. -
isFormatAsBlock
-
isInlineable
-