npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

dom-traversal-functions

v1.3.2

Published

Standardized, zero-dependency DOM traversal and data extraction utilities for component event architectures

Readme

dom-traversal-functions

Standardized, instruction-driven DOM traversal and data extraction utilities for table component architectures.

Extracting rows, reading input values, and navigating table structures in application handlers leads to brittle, tangled DOM code. dom-traversal-functions isolates all DOM querying mechanics into granular, single-responsibility functions organized strictly around the 3-part narrative story of the table control.

In V3, every traversal operation is powered by declarative instructions.json executed through dom-primitive-engine.


📖 The Architecture Story: Semantic Concerns

Every complex data control tells a story from top to bottom. For a Table, its operations are divided strictly across its three structural zones:

┌────────────────────────────────────────────────────────────────────────┐
│                        TABLE COMPONENT STORY                           │
└────────────────────────────────────────────────────────────────────────┘
                                   │
      ┌────────────────────────────┼────────────────────────────┐
      ▼                            ▼                            ▼
[ 1. HEADER CONCERN ]      [ 2. BODY CONCERN ]        [ 3. FOOTER CONCERN ]
Search & Top Controls      Rows, Data & Actions       Data Entry & New Rows
─────────────────────      ────────────────────       ─────────────────────
• getSearchQuery           • getRowElement            • getFooterData
• instructions.json        • getRowIndex              • clearRowInputs
                           • highlightRow             • instructions.json
                           • getRowData
                           • instructions.json

🚀 Quick Start

1. Modern ESM Import

import { table } from "dom-traversal-functions";

// 1. Header: Extract search query from input or event
const query = table.header.getSearchQuery(searchInput);

// 2. Body: Extract row data or highlight selected row
const rowData = table.body.getRowData(clickedElement, { columns });
table.body.highlightRow(rowElement, "table-primary");

// 3. Footer: Extract inputs from footer row & clear inputs
const newRecord = table.footer.getFooterData(saveButton, columns);
table.footer.clearRowInputs(saveButton);

2. Global Script (Zero-Import Workflow)

Load the bundle via CDN or script tag:

<script src="https://cdn.jsdelivr.net/npm/dom-traversal-functions/docs/dist/v3/min.js"></script>

It automatically registers on window.ks.domTraversal.table:

const { header, body, footer } = ks.domTraversal.table;

🧩 Declarative Traversal (instructions.json)

Each semantic area exports its own serializable instructions.json recipe executed by dom-primitive-engine:

import { table } from "dom-traversal-functions";

// Inspect or reuse the declarative JSON traversal recipes:
console.log(table.header.instructions);
console.log(table.body.instructions);
console.log(table.footer.instructions);

Example: Body Traversal (src/v3/table/body/instructions.json)

[
  {
    "narration": "Find closest body table row",
    "sourcePath": { "fileName": "root" },
    "func": "closest",
    "arguments": { "selector": "tr" }
  },
  {
    "narration": "Collect all data cells from row",
    "sourcePath": { "fileName": "previous" },
    "func": "querySelectorAll",
    "arguments": { "selector": "td" }
  },
  {
    "narration": "Map collected cell values to columns using clientData",
    "sourcePath": { "fileName": "previous" },
    "func": "mapValues",
    "arguments": { "read": "text" }
  }
]

📦 Companion Ecosystem


License

MIT © KeshavSoft