lib/widgets/blocks.js
/**
 * Find the entire ancestry (root first) of a block with the specified id
 *
 * @param rootBlockDef root block to search in
 * @param createBlock
 * @param blockId block to find
 * @returns array of child blocks, each with information about which context variables were injected by their parent
 */
Find the entire ancestry (root first) of a block with the specified id
@param rootBlockDef root block to search in
@param createBlock
@param blockId block to find
@returns array of child blocks, each with information about which context variables were injected by their parent
Find the entire ancestry ( root first ) of a block with the specified id @param rootBlockDef root block to search in @param createBlock @param blockId block to find @returns array of child blocks each with information about which context variables were injected by their parent
function findBlockAncestry(rootBlockDef, createBlock, contextVars, blockId) {
    var rootBlock = createBlock(rootBlockDef);
    if (rootBlock.id === blockId) {
        return [{ blockDef: rootBlockDef, contextVars: contextVars }];
    }
    for (var _i = 0, _a = rootBlock.getChildren(contextVars); _i < _a.length; _i++) {
        var childBlock = _a[_i];
        if (childBlock.blockDef) {
            var childAncestry = findBlockAncestry(childBlock.blockDef, createBlock, childBlock.contextVars, blockId);
            if (childAncestry) {
                return [{ blockDef: rootBlockDef, contextVars: contextVars }].concat(childAncestry);
            }
        }
    }
    return null;
}
function findBlockAncestry ( rootBlockDef , createBlock , contextVars , blockId ) { var rootBlock = createBlock ( rootBlockDef ) ; if ( rootBlock . id === blockId ) { return [ { blockDef : rootBlockDef , contextVars : contextVars } ] ; } for ( var _i = 0 , _a = rootBlock . getChildren ( contextVars ) ; _i < _a . length ; _i ++ ) { var childBlock = _a [ _i ] ; if ( childBlock . blockDef ) { var childAncestry = findBlockAncestry ( childBlock . blockDef , createBlock , childBlock . contextVars , blockId ) ; if ( childAncestry ) { return [ { blockDef : rootBlockDef , contextVars : contextVars } ] . concat ( childAncestry ) ; } } } return null ; }
Find the entire ancestry (root first) of a block with the specified id
 @param rootBlockDef root block to search in
 @param createBlock
 @param blockId block to find
 @returns array of child blocks, each with information about which context variables were injected by their parent
Find the entire ancestry ( root first ) of a block with the specified id @param rootBlockDef root block to search in @param createBlock @param blockId block to find @returns array of child blocks each with information about which context variables were injected by their parent
// Return self if true // For each child