mutant
Version:
Create observables and map them to DOM elements. Massively inspired by hyperscript and observ-*. No virtual dom, just direct observable bindings. Unnecessary garbage collection is avoided by using mutable objects instead of blasting immutable junk all ove
17 lines (15 loc) • 355 B
JavaScript
module.exports = function walk (node, fn) {
var current = node
while (current) {
fn(current)
current = nextNode(current, node)
}
}
function nextNode (current, root) {
var result = current.firstChild
while (current && !result && current !== root) {
result = current.nextSibling
current = current.parentNode
}
return result
}