Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/gauntlet/imports/happy_dom.ts>Text

Work-in-progress front-end tool which does put a smile on my face
Latest
class Text
implements IText
extends Node
Re-export
import { Text } from "https://deno.land/x/gauntlet@v0.0.9/imports/happy_dom.ts";

Text node.

Constructors

new
Text(text?: string)

Constructor.

Properties

private
_data
data: string

Returns text content.

readonly
length: number

Returns text content.

readonly
nextElementSibling: IElement

Next element sibling.

readonly
nodeName: string

Node name.

readonly
nodeType: number
nodeValue: string

Returns node value.

readonly
previousElementSibling: IElement

Previous element sibling.

textContent: string

Returns text content.

Methods

after(...nodes: (string | Node)[]): void

Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just after this ChildNode. DOMString objects are inserted as equivalent Text nodes.

appendData(data: string): void

Appends the given DOMString to the CharacterData.data string; when this method returns, data contains the concatenated DOMString.

before(...nodes: (string | Node)[]): void

Inserts a set of Node or DOMString objects in the children list of this ChildNode's parent, just before this ChildNode. DOMString objects are inserted as equivalent Text nodes.

cloneNode(deep?: boolean): IText

Clones a node.

deleteData(offset: number, count: number): void

Removes the specified amount of characters, starting at the specified offset, from the CharacterData.data string; when this method returns, data contains the shortened DOMString.

insertData(offset: number, data: string): void

Inserts the specified characters, at the specified offset, in the CharacterData.data string; when this method returns, data contains the modified DOMString.

remove(): void

Removes the object from its parent children list.

replaceData(
offset: number,
count: number,
data: string,
): void

Replaces the specified amount of characters, starting at the specified offset, with the specified DOMString; when this method returns, data contains the modified DOMString.

replaceWith(...nodes: (Node | string)[]): void

The Node.replaceWith() method replaces this Node in the children list of its parent with a set of Node or DOMString objects.

substringData(offset: number, count: number): string

Returns a DOMString containing the part of CharacterData.data of the specified length and starting at the specified offset.

toString(): string

Converts to string.