Please tell me which libraries other than jQuery to traverse DOM.

Asked 5 months ago, Updated 5 months ago, 18 views

For now I know szarouski/lodash.dom-traverse. I would appreciate it if it was provided in npm.

A replacement has been found for the following features of jQuery:

QuerySelectorAllThe following methods in jQuery

can be used to obtain DOM elements that cannot be retrieved in a single shot.
  • parent()
  • prev()
  • children()

Retrieving using the .

Looking for a replacement library for these operations.

Also, since I use browserify, I am happy to be able to manage packages consistently if they are provided by npm.

javascript browserify

2022-09-30 11:57

4 Answers

Voyeur.js ( or Dojo (DOM module only).

Instead of a non-jQuery library (the new library is usually harder to learn than the new language...), what I want to do with raw js is:

var myDiv= document.getElementById('myDiv');
for (vari=0; i<as.length;i++)

Simple with recent browsers (foo.querySelectorAll:

2022-09-30 11:57

I've never used it myself, but it's small and fast at 1.3k.

However, document.querySelectorAll() may be enough for this purpose.In the past, JS did not own a query engine and went through the sizzle that jQuery contained, but now JS can use the query engine as a standard.

Note: I use cheeriojs/cheerio when I do DOM scraping on the server side.

2022-09-30 11:57


Small, fast, and modular DOM&Event library for modern browsers. Same family API as jQuery (but without the extra "weight" of modules like $.ajax, $.animate, and $.Deferred). Weights in at only 3 to 14KB (minified), dependent on included modules. Full bundle is under 5KB gzipped.

It's also in npm, and it's like jQuery excludes heavy APIs.


Zepto is a minimalist JavaScript library for modern browsers with early jQuery-compatible API.If you use jQuery, you already know how to use Zepto.

Compatible with jQuery.It is often introduced as for smartphones.


Returning the $.

It's a little strange, but it's like jQuery.Less Traversal Module.


Voyeur is atiny (1.2kb) Javascript library that lets you traverse and manage the DOM the way it should have been.

This is not an API like jQuery, but you can use it as follows:"Highlighted!");

2022-09-30 11:57


After reading the question, the server will do a DOM operation to the jQuery-like
I feel like you're looking for a way to do it.

jsdom is a DOM implementation available in Node.js(orio.js) and
In conjunction with the DOM operating library running on the DOM of jQuery etc. You can use it.

Charlie Robbins "Scrapping with jsdom.js and jquery"

2022-09-30 11:57

If you have any answers or tips

© 2023 OneMinuteCode. All rights reserved.