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

x/html_parser/src/mod.ts>DomUtils.getSiblings

Port of fb55/htmlparser2 for Deno
Latest
function DomUtils.getSiblings
import { DomUtils } from "https://deno.land/x/html_parser@v0.1.3/src/mod.ts";
const { getSiblings } = DomUtils;

Gets an elements siblings, including the element itself.

Attempts to get the children through the element's parent first. If we don't have a parent (the element is a root node), we walk the element's prev & next to get all remaining nodes.

Parameters

elem: Node

Element to get the siblings of.

Returns

elem's siblings.