getAllMdlComponents function

List<MdlComponent> getAllMdlComponents (HtmlElement element)

Returns all MdlComponents in subtree

Implementation

List<MdlComponent> getAllMdlComponents(final dom.HtmlElement element) {
    Validate.notNull(element);

    final List<MdlComponent> components = new List<MdlComponent>();

    _iterateOverAllHTMLElements(final dom.HtmlElement element) {
        if(element is dom.HtmlElement) {
            element.children.forEach((final dom.Element element) => _iterateOverAllHTMLElements(element));
            //_logger.info("E: $element ID: ${element.id} - classes: ${element.classes}");
            if(isMdlComponent(element)) {
                //_logger.shout("E: $element ID: ${element.id} - classes: ${element.classes}");
                components.addAll(mdlComponents(element));
            }
        }
    }

    _iterateOverAllHTMLElements(element);
    //_logger.info("#${counter} Elements found");
    //_logger.info("#${components.length} Components found");

    return new UnmodifiableListView(components);
}