explaingit

riot/dom-nodes

Analysis updated 2026-07-25 · repo last pushed 2026-01-24

4JavaScriptAudience · developerComplexity · 2/5QuietSetup · easy

TLDR

A small JavaScript library that provides ready-made functions to check if a tag is HTML, SVG, self-closing, or a boolean attribute, so you don't have to maintain those lists yourself.

Mindmap

mindmap
  root((repo))
    What it does
      Checks HTML and SVG tags
      Identifies void elements
      Detects boolean attributes
    Key functions
      isHtml and isSvg
      isVoid and isCustom
      hasValueAttribute
    Use cases
      Web frameworks
      Templating engines
      Custom UI libraries
    Design choices
      Self-contained with no dependencies
      Case-insensitive matching
      Bundles tag lists in source

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Build a templating engine that automatically self-closes void tags like img and br.

USE CASE 2

Create a web framework that distinguishes custom elements from standard HTML tags.

USE CASE 3

Validate HTML input by checking if tag names and attributes are standard.

USE CASE 4

Generate correct HTML output by checking if an attribute is boolean.

What is it built with?

JavaScript

How does it compare?

riot/dom-nodesamirmahdavi2023/d1-adminanil-matcha/open-poe-ai
Stars444
LanguageJavaScriptJavaScriptJavaScript
Last pushed2026-01-242026-06-25
MaintenanceQuietActive
Setup difficultyeasyeasymoderate
Complexity2/52/53/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

No special setup needed, just install via npm and import the functions.

In plain English

dom-nodes is a small JavaScript library that helps code answer simple questions about HTML and SVG tags. Questions like: is "img" a self-closing tag? Is "circle" an SVG element? Is "selected" a boolean attribute? Instead of a developer writing these checks from scratch or maintaining their own lists, this package provides ready-made functions that return true or false. The library bundles complete lists of all standard HTML tags, SVG tags, void elements (tags that don't need a closing slash, like "img" or "br"), boolean attributes (like "checked" or "disabled"), and elements that accept a value attribute. It exposes simple functions like isHtml, isSvg, isVoid, isCustom, hasValueAttribute, and isBoolAttribute. You pass in a tag name as a string, and the function tells you what category it falls into. The checks are case-insensitive, so "IMG", "img", and "Img" all work the same way. Someone building a web framework, a templating engine, or a custom UI library would use this. For example, if you are writing code that takes a tag name and needs to generate the right HTML output, you need to know whether to self-close the tag or not. Or if you are building a component system and someone writes "my-component", you need to distinguish that custom element from a standard tag like "div". These are the kinds of decisions this library helps automate. One notable design choice is that the project copies its tag lists directly into its own source code rather than depending on other npm packages at runtime. It credits two existing projects as the source of those lists but avoids pulling them in as dependencies. That keeps the package self-contained and lightweight for what is fundamentally just string matching against known lists.

Copy-paste prompts

Prompt 1
How do I use the dom-nodes library to check if a tag name like 'img' is a void element that doesn't need a closing tag?
Prompt 2
Write a function using dom-nodes that takes a list of tag names and separates them into HTML tags, SVG tags, and custom elements.
Prompt 3
Using dom-nodes, how can I check if the 'disabled' attribute is a boolean attribute before rendering it in my templating engine?
Prompt 4
Show me how to import and use isVoid and isBoolAttribute from dom-nodes in a Node.js script to analyze HTML tags.

Frequently asked questions

What is dom-nodes?

A small JavaScript library that provides ready-made functions to check if a tag is HTML, SVG, self-closing, or a boolean attribute, so you don't have to maintain those lists yourself.

What language is dom-nodes written in?

Mainly JavaScript. The stack also includes JavaScript.

Is dom-nodes actively maintained?

Quiet — no commits in 6-12 months (last push 2026-01-24).

How hard is dom-nodes to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is dom-nodes for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Verify against the repo before relying on details.