
* fix: update to latest sapper fixes #416 * fix error and debug pages * requestIdleCallback makes column switching feel way nicer than double rAF * add export feature * add better csp info * workaround for sapper sub-page issue * clarify in readme about exporting * fix now config * switch from rIC to triple raf * style-loader is no longer used * update theming guide
16 lines
439 B
JavaScript
16 lines
439 B
JavaScript
// Check if some condition applies for a node or any of its ancestors,
|
|
// stopping at an element that returns true for the given stopFunc. Returns
|
|
// false if none match
|
|
export function checkDomAncestors (node, checkFunc, stopFunc) {
|
|
let thisNode = node
|
|
while (thisNode) {
|
|
if (stopFunc(thisNode)) {
|
|
break
|
|
}
|
|
if (checkFunc(thisNode)) {
|
|
return true
|
|
}
|
|
thisNode = thisNode.parentElement
|
|
}
|
|
return false
|
|
}
|