All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.src.utils.walk.js Maven / Gradle / Ivy

There is a newer version: 3.14.1
Show newest version
export function walk(el, callback) {
    if (typeof ShadowRoot === 'function' && el instanceof ShadowRoot) {
        Array.from(el.children).forEach(el => walk(el, callback))

        return
    }

    let skip = false

    callback(el, () => skip = true)

    if (skip) return

    let node = el.firstElementChild

    while (node) {
        walk(node, callback, false)

        node = node.nextElementSibling
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy