Skip to content

Document how to access possible values for Node.nodeType #351

Description

@pyrsmk

Testing nodes for their types is a fairly common task so it would be more practical to access to NodeType constants instead of dealing with integers (which are not documented). Here's an example of what I want to do:

const { DOMParser, NodeType } = require('@xmldom/xmldom')

const xml = new DOMParser().parseFromString(contents)
const rows = Array.from(xml.childNodes[2].childNodes).filter(node => node.nodeType == NodeType.ELEMENT_NODE)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationgood first issueGood for newcomershelp-wantedExternal contributions welcomespec:DOM-Level-2https://www.w3.org/TR/DOM-Level-2-Core/typesAnything regarding Typescript

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions