Skip to content

Latest commit

History

14 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

simple-html-dom-parser

Build Status

Install

npm install simple-html-dom-parser

API

/** * @param {String} html * @param {Object} options * @returns {DomObject} */parse(html,options)

options - Optional object of options:

{regex: {name: /[a-zA-Z_][\w:\-\.]*/,//Regex for element nameattribute: /[a-zA-Z_][\w:\-\.]*///Regex for attribute name}}

{DomObject} - object with next structure

{type: 'document',children: []}

children: is array of objects of next types

{type: 'doctype'||'comment'||'text',parent: {DomObject},prev: {DomObject}||null,next: {DomObject}||null,data: {String}}{type: 'tag',name: {String},attr: {id: 'example'},unary: false,// shows is tag self-closing or notparent: {DomObject},prev: {DomObject}||null,next: {DomObject}||null,children: []}
/** * @param {DomObject} dom * @returns {String} */getOuterHTML(dom)
/** * @param {DomObject} dom * @returns {String} */getInnerHTML(dom)

About

Simple html to dom parser

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages