Text

Text

Plain text in an element.

Constructor

new Text(txt)

Description:
  • Creates an instance of Text.
Source:
Parameters:
Name Type Description
txt string The unescaped text

Extends

Classes

Text

Members

(readonly) document

Description:
  • Find the Document that this node is in, if it is in a Document.
Source:
Overrides:
Find the Document that this node is in, if it is in a Document.

(nullable) parent :Node

Source:
Overrides:
Type:

Methods

first(pattern, contextopt) → {string|Node|number|null}

Description:
  • Get the first matching node for a given pattern, or null if none exist.
Source:
Overrides:
Parameters:
Name Type Attributes Default Description
pattern string | XPath The pattern to match
context Node <optional>
this The context node. Uses this node as context if none is provided.
Returns:
The first match if one exists
Type
string | Node | number | null

get(pattern, contextopt) → {XPathResult}

Description:
  • Get all of the nodes that match the given XPath pattern, with the given context for XPath execution.
Source:
Overrides:
Parameters:
Name Type Attributes Default Description
pattern string | XPath The pattern to match
context Node <optional>
this The context node. Uses this node as context if none is provided.
Returns:
The matching nodes
Type
XPathResult

text(newTextopt) → {string|Node}

Description:
  • Get or set the text contained in this node.
Source:
Overrides:
Parameters:
Name Type Attributes Description
newText string <optional>
If given, set the text of the node. Otherwise, gets the contained text.
Returns:
null on set, string on get.
Type
string | Node

toString(optionsopt) → {string}

Description:
  • Convert to string. If not in a CDataSection, escape text.
Source:
Overrides:
Parameters:
Name Type Attributes Description
options MaybeStylizedSeparated <optional>
How to convert to string
Returns:
The node, converted to a string
Type
string