Dome is the DOM library part of Cull.JS, the functional JavaScript toolbelt for adults. Refer to Cull.JS for motivation behind our API design and the general underlying philosophy.
- children
(elements)
- id
(idStr)
- byClass
(className, parent)
- remove
(element)
- replace
(element, replacement)
- hasClassName
(className, element)
- addClassName
(cn, element)
- removeClassName
(cn, element)
- text
(elm)
- frag
(items)
- uuid
(object)
- contains
(element, child)
- setData
(data, element)
- getData
(property, element)
- setProp
(properties, element)
- append
(content, element)
- setContent
(children, element)
var parent = dome.el("div", [dome.el("div")]);
var placeholder = parent.firstChild;
var el = dome.replace(placeholder, dome.el("p"));
assert.tagName(el, "p");
refute.same(parent.firstChild, placeholder);
var el = document.createElement("p");
el.innerHTML = "Hey there";
assert.equals(dome.text(el), "Hey there");
var frag = dome.frag();
assert.equals(frag.nodeType, 11);
var object = {};
var id = dome.uuid(object);
assert.equals(id, dome.uuid(object));
assert.isNumber(id);
var parent = dome.el("div", [dome.el("div")]);
var child = parent.firstChild;
assert(dome.contains(parent, child));
Either:
./node_modules/.bin/buster-server
Hit localhost:1111/capture and then:
./node_modules/.bin/buster-test
Or
npm test
Then hit localhost:8282
- Martin Solli contributed bug fixes for Opera.
Thanks!
Copyright © 2012-2013, Christian Johansen and Magnar Sveen. Dome uses semantic versioning. Code released under the BSD license. Documentation released under CC Attribution-Share Alike.