Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/html_parser/src/utils/mod.ts

Port of fb55/htmlparser2 for Deno
Latest
import * as htmlParser from "https://deno.land/x/html_parser@v0.1.3/src/utils/mod.ts";

Functions

Append an element after another.

Append a child to an element.

Compare the position of one node against another node in any other document. The return value is a bitmask with the following values:

Search a node and its children for nodes passing a test function.

Search an array of node and its children for nodes passing a test function.

Search and array of nodes and its children for nodes passing a test function.

Finds one element in a tree that passes a test.

Finds the first element inside of an array that matches a test function.

Gets an attribute from an element.

Get a node's children.

f
getInnerHTML
deprecated

Get the tag name of an element.

f
getOuterHTML
deprecated

Gets an elements siblings, including the element itself.

f
getText
deprecated

Get a node's inner text. Same as textContent, but inserts newlines for <br> tags.

Checks whether an element has an attribute.

Get a node's inner text.

Returns the next element sibling of a node.

Prepend an element before another.

Prepend a child to an element.

Returns the previous element sibling of a node.

Remove an element from the dom

Given an array of nodes, remove any member that is contained by another.

Replace an element in the dom

Get a node's text content.

Sort an array of nodes based on their relative position in the document and remove any duplicate nodes. If the array contains nodes that do not belong to the same document, sort order is unspecified.