Class Text
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The Text interface represents a text Node in a DOM tree.
[Value("Text")]
public class Text : CharacterData, NonDocumentTypeChildNode, ChildNode, GeometryUtils, Slottable
- Inheritance
-
Text
- Implements
- Derived
- Inherited Members
Remarks
To understand what a text node is, consider the following document:
In that document, there are five text nodes, with the following contents:
Each of those text nodes is an object that has the properties and methods documented in this article.
Constructors
Text()
public Text()
Text(string)
The Text() constructor returns a new Text object
with the optional string given in parameter as its textual content.
public Text(string data = null)
Parameters
datastring
Remarks
-The DOM API
Properties
WholeText
The read-only wholeText property of the Text interface
returns the full text of all Text nodes logically adjacent to the node.
The text is concatenated in document order.
This allows specifying any text node and obtaining all adjacent text as a single string.
[Value("wholeText")]
public string WholeText { get; }
Property Value
- string
A string with the concatenated text.
Remarks
NOTE
This is similar to calling Normalize() followed by reading the text value,
but without modifying the tree.
-The Text interface it belongs to.
Methods
SplitText(ulong)
The splitText() method of the Text interface
breaks the Text node into two nodes at the specified offset,
keeping both nodes in the tree as siblings.
[Value("splitText")]
public Text SplitText(ulong offset)
Parameters
offsetulong
Returns
Remarks
After the split, the current node contains all the content
up to the specified offset point,
and a newly created node of the same type contains the remaining text.
The newly created node is returned to the caller.
If the original node had a parent, the new node is inserted as the next sibling of the original node.
If the offset is equal to the length of the original node,
the newly created node has no data.
Separated text nodes can be concatenated using the Normalize()
method.
-The Text interface it belongs to.
-The opposite method: Normalize().