You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Björn f184cd7e2a adding 4 years ago
..
LICENSE adding 4 years ago
README.md adding 4 years ago
index.js adding 4 years ago
index.next.js adding 4 years ago
package.json adding 4 years ago

README.md

bianco.dom-to-array

Build Status

NPM version NPM downloads MIT License

Usage

import domToArray from 'bianco.dom-to-array'

var div = document.createElement('div')
div.innerHTML = `
  <ul>
    <li>one</li>
    <li>two</li>
  </ul>
`
body.appendChild(div)

// It can convert node list
const lis = document.querySelectorAll('li')
const $lis = domToArray(lis)
$lis.length // => 2
Array.isArray($lis) // => true

// It can convert a single node
const li = document.querySelector('li')
const $li = domToArray(li)
$li.length // => 1
Array.isArray($li) // => true

API

domToArray

Converts any DOM node/s to a loopable array

Parameters

Returns Array always a loopable object