dom-build
Build DOM trees in Javascript with shortcut syntax for grabbing references to generated elements.
There are lots of libraries that perform a similar function but none I've encountered allow you to get a reference to anything but the root node. dom-build
introduces the !key
selector syntax to indicate that a generated element should be attached to the returned object structure via the named key. Example:
var d = ; var ui = ;
This yields the ui
object comprising these keys:
root
: the element created by the outermost call tod()
myMessage
: a raw text node; the contents ofspan.myMessage
foo
: equivalent toroot
;div#root.a.b.c
link
:a.active
bold
:<b>here's some bold text</b>