New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@ultraq/dom-utils

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ultraq/dom-utils

A collection of utilities for working with the DOM

latest
Source
npmnpm
Version
0.5.1
Version published
Maintainers
1
Created
Source

dom-utils

Build Status codecov npm Bundlephobia minified size

A collection of utilities for working with the DOM.

Installation

npm install @ultraq/dom-utils

API

addEventDelegate(element, eventName, selector, handler)

Add an event listener to element that only fires when the target of the event matches selector.

  • element:
  • eventName:
  • selector:
  • handler:

clearChildren(element)

Removes all of an element's child nodes.

  • element

deserialize(htmlString)

Deserialize an HTML string into a document fragment.

  • htmlString

parseJsonFromElement(selector)

Parse the text content of the element picked out by the given selector as JSON data, returning it as an object. Returns null if no data could be read.

  • selector: a CSS selector for picking out the HTML element that contains the JSON data
  • scope: optional, the DOM tree to run the selector over. Defaults to the current document.

serialize(documentOrFragment)

Serialize a document or document fragment into an HTML string.

  • documentOrFragment

Keywords

dom

FAQs

Package last updated on 20 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts