stream in dom elements or html strings to add and update them as a nested multidimensional array
Stream in dom elements or html strings to add and update them as a nested multidimensional array.
Bundle this module with browserify.
var ndElement = require'nd-element';var target = documentquerySelector'#content';var n = ndElementtarget;var docs ='<div data-point="0,0,1">a</div>''<div data-point="0,0,2">b</div>''<div data-point="2,0,2">c</div>''<div data-point="0,1,3">d</div>'docsforEach nwritedoc ;
#content element will now contain this html structure (without the extra
whitespace added here for legibility):
Returns a new
nd-element writable stream. Write html strings or html elements
with a comma-separated n-dimensional point path in
data-point attribute. The
element will be modified to create the n-dimensional structure
required by the
opts.point = 'data-point'the attribute that contains the point path
opts.container = 'data-container'the attribute for container indexes
opts.tag = 'div'the tag to use for containers
opts.id = element.id || 'nd-element-'+nthe id of the base element (the base element must have an id set for the
>selector this module uses)
You can use
nd-point to find a
multidimensional point for objects based on their properties.
Please make any changes to the
.coffee source files and
npm build before
sending a pull request.