def getFootnoteAnchorDict(pageAst):
    """
    Returns a new or cached dictionary of footnote anchors
    {footnoteId: anchorNode} from a page ast.
    """
    if pageAst is None:
        return
    if not hasattr(pageAst, "footnoteAnchorDict"):
        result = {}
#         fnNodes = pageAst.iterSelectedDeepByName("footnote",
#                 frozenset(("indentedText", "orderedList", "unorderedList",
#                 "heading", "headingContent")))

        fnNodes = pageAst.iterDeepByName("footnote")

        for node in fnNodes:
            result[node.footnoteId] = node

        pageAst.footnoteAnchorDict = result

    return pageAst.footnoteAnchorDict