elementize

Convert HTML into an array of DOM Elements

npm install elementize
4 downloads in the last day
7 downloads in the last week
35 downloads in the last month

elementize

browser support

Convert HTML into an array of DOM Elements

NPM

Example

var elementize = require('elementize')
var elements = elementize('<html><head><title>Test</title></head><body><div>Content</div></body></html>')
elements[0].nodeName //= HTML
elements[0].children[0].nodeName //= HEAD
var elementize = require('elementize')
var elements = elementize('Test 123 <span>Stuff</span> more text')
elements[0].nodeName //= #text
elements[1].nodeName //= SPAN
elements[2].nodeName //= #text
var elementize = require('elementize')
var element = elementize.first('  <div>first element, text nodes ignored</div>  <div>Extra</div>')
element.outerHTML //= <div>first element, text nodes ignored</div>
npm loves you