mithril-vndb/render/domFor.js

22 lines
No EOL
346 B
JavaScript

"use strict"
var delayedRemoval = new WeakMap
function *domFor({dom, domSize}, {generation} = {}) {
if (dom != null) do {
const {nextSibling} = dom
if (delayedRemoval.get(dom) === generation) {
yield dom
domSize--
}
dom = nextSibling
}
while (domSize)
}
module.exports = {
delayedRemoval: delayedRemoval,
domFor: domFor,
}