mdlComponents function

List<MdlComponent> mdlComponents (HtmlElement element)

Returns all the MDL-Components registered for this element

Implementation

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

    final List<MdlComponent> components = new List<MdlComponent>();
    if(!isMdlComponent(element)) {
        return components;
    }

    var jsElement = new JsObject.fromBrowserObject(element);
    final List<String> names = mdlComponentNames(element);
    names.forEach((final String name) {
        if(jsElement.hasProperty(name)) {
            components.add(jsElement[name] as MdlComponent);
        }
    });

    return components;
}