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 🙏

© 2025 – Pkg Stats / Ryan Hefner

dom-nodes

v1.1.3

Published

List of all the available DOM and SVG nodes and helper functions to quickly test against them

Downloads

3,302

Readme

dom-nodes

Build Status

NPM version NPM downloads MIT License

Installation

$ npm i dom-nodes -S

Usage

import {isVoid} from 'dom-nodes'
isVoid('div') // false
isVoid('img') // true

dom-nodes exports all the methods listed below giving you some simple tests to understand which kind of node you are dealing with.

This project includes html-tags and svg-tag-names directly in its source code avoiding to rely on third party npm modules for such simple list of strings. This project couldn't have been made without the projects above!

API

Table of Contents

VOID_SVG_TAGS_LIST

SVG void elements that cannot be auto-closed and shouldn't contain child nodes.

Type: Array

HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_LIST

List of html elements where the value attribute is allowed

Type: Array

SVG_TAGS_LIST

List of all the available svg tags

Type: Array

VOID_HTML_TAGS_LIST

HTML void elements that cannot be auto-closed and shouldn't contain child nodes.

Type: Array

HTML_TAGS_LIST

List of all the html tags

Type: Array

BOOLEAN_ATTRIBUTES_LIST

List of all boolean HTML attributes

Type: RegExp

HTML_TAGS_RE

Regex matching all the html tags ignoring the cases

Type: RegExp

SVG_TAGS_RE

Regex matching all the svg tags ignoring the cases

Type: RegExp

VOID_HTML_TAGS_RE

Regex matching all the void html tags ignoring the cases

Type: RegExp

VOID_SVG_TAGS_RE

Regex matching all the void svg tags ignoring the cases

Type: RegExp

HTML_ELEMENTS_HAVING_VALUE_ATTRIBUTE_RE

Regex matching all the html tags where the value tag is allowed

Type: RegExp

BOOLEAN_ATTRIBUTES_RE

Regex matching all the boolean attributes

Type: RegExp

isVoid

True if it's a self closing tag

Parameters

Examples

isVoid('meta') // true
isVoid('circle') // true
isVoid('IMG') // true
isVoid('div') // false
isVoid('mask') // false

Returns boolean true if void

isHtml

True if it's a known HTML tag

Parameters

Examples

isHtml('img') // true
isHtml('IMG') // true
isHtml('Img') // true
isHtml('path') // false

Returns boolean true if html tag

isSvg

True if it's a known SVG tag

Parameters

Examples

isSvg('g') // true
isSvg('radialGradient') // true
isSvg('radialgradient') // true
isSvg('div') // false

Returns boolean true if svg tag

isCustom

True if it's not SVG nor a HTML known tag

Parameters

Examples

isCustom('my-component') // true
isCustom('div') // false

Returns boolean true if custom element

hasValueAttribute

True if the value attribute is allowed on this tag

Parameters

Examples

hasValueAttribute('input') // true
hasValueAttribute('div') // false

Returns boolean true if the value attribute is allowed

isBoolAttribute

True if it's a boolean attribute

Parameters

  • attribute string test attribute

Examples

isBoolAttribute('selected') // true
isBoolAttribute('class') // false

Returns boolean true if the attribute is a boolean type