RichText/Archived/Rooster/Rooster.gcomp/Support/node_modules/roosterjs/dist/rooster-amd.js
/**
 * Find closest element ancestor start from the given node which matches the given selector
 * @param node Find ancestor start from this node
 * @param root Root node where the search should stop at. The return value can never be this node
 * @param selector The expected selector. If null, return the first HTML Element found from start node
 * @returns An HTML element which matches the given selector. If the given start node matches the selector,
 * returns the given node
 */
Find closest element ancestor start from the given node which matches the given selector
@param node Find ancestor start from this node
@param root Root node where the search should stop at. The return value can never be this node
@param selector The expected selector. If null, return the first HTML Element found from start node
@returns An HTML element which matches the given selector. If the given start node matches the selector,
returns the given node
Find closest element ancestor start from the given node which matches the given selector @param node Find ancestor start from this node @param root Root node where the search should stop at . The return value can never be this node @param selector The expected selector . If null return the first HTML Element found from start node @returns An HTML element which matches the given selector . If the given start node matches the selector returns the given node
function findClosestElementAncestor(node, root, selector) {
    node = !node ? null : node.nodeType == 1  ? node : node.parentNode;
    var element = node && node.nodeType == 1  ? node : null;
    if (element && selector) {
        if (element.closest) {
            element = element.closest(selector);
        }
        else {
            while (element &&
                element != root &&
                !(element.matches || element.msMatchesSelector).call(element, selector)) {
                element = element.parentElement;
            }
        }
    }
    return !root || contains_1.default(root, element) ? element : null;
}
function findClosestElementAncestor ( node , root , selector ) { node = ! node ? null : node . nodeType == 1 ? node : node . parentNode ; var element = node && node . nodeType == 1 ? node : null ; if ( element && selector ) { if ( element . closest ) { element = element . closest ( selector ) ; } else { while ( element && element != root && ! ( element . matches || element . msMatchesSelector ) . call ( element , selector ) ) { element = element . parentElement ; } } } return ! root || contains_1 . default ( root , element ) ? element : null ; }
Find closest element ancestor start from the given node which matches the given selector
 @param node Find ancestor start from this node
 @param root Root node where the search should stop at.
Find closest element ancestor start from the given node which matches the given selector @param node Find ancestor start from this node @param root Root node where the search should stop at .
/* Element */ /* Element */