You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

dom-walk

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dom-walk

iteratively walk a DOM node


Version published
Weekly downloads
4.1M
decreased by-18.44%
Maintainers
1
Install size
3.40 kB
Created
Weekly downloads
 

Package description

What is dom-walk?

The dom-walk npm package is a utility for traversing and manipulating the DOM (Document Object Model) in a simple and efficient manner. It allows developers to walk through the DOM tree, either up or down, and apply functions or retrieve information from the DOM elements.

What are dom-walk's main functionalities?

Walking the DOM tree

This feature allows you to traverse all nodes within a specified DOM element (e.g., document.body). The function passed to walk will be called with each node as it is visited.

var walk = require('dom-walk');
var elements = [];
walk(document.body, function (node) {
  elements.push(node);
});

Collecting specific elements

This code demonstrates how to use dom-walk to collect all input elements from the DOM. It walks through the DOM and conditionally pushes nodes that are input elements into an array.

var walk = require('dom-walk');
var inputs = [];
walk(document.body, function (node) {
  if (node.tagName === 'INPUT') {
    inputs.push(node);
  }
});

Other packages similar to dom-walk

Readme

Source

dom-walk

iteratively walk a DOM node

Example

var walk = require("dom-walk")

walk(document.body.childNodes, function (node) {
    console.log("node", node)
})

Installation

npm install dom-walk

Contributors

  • Raynos

MIT Licenced

FAQs

Package last updated on 03 Apr 2020

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc