Search in sources :

Example 1 with HtmlMap

use of com.gargoylesoftware.htmlunit.html.HtmlMap in project htmlunit by HtmlUnit.

the class HTMLMapElement method getAreas.

/**
 * Returns the value of the JavaScript attribute {@code areas}.
 * @return the value of this attribute
 */
@JsxGetter
public HTMLCollection getAreas() {
    if (areas_ == null) {
        final HtmlMap map = (HtmlMap) getDomNodeOrDie();
        areas_ = new HTMLCollection(map, false) {

            @Override
            protected List<DomNode> computeElements() {
                final List<DomNode> list = new ArrayList<>();
                for (final DomNode node : map.getChildElements()) {
                    if (node instanceof HtmlArea) {
                        list.add(node);
                    }
                }
                return list;
            }
        };
    }
    return areas_;
}
Also used : HtmlArea(com.gargoylesoftware.htmlunit.html.HtmlArea) DomNode(com.gargoylesoftware.htmlunit.html.DomNode) HtmlMap(com.gargoylesoftware.htmlunit.html.HtmlMap) ArrayList(java.util.ArrayList) List(java.util.List) JsxGetter(com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter)

Aggregations

DomNode (com.gargoylesoftware.htmlunit.html.DomNode)1 HtmlArea (com.gargoylesoftware.htmlunit.html.HtmlArea)1 HtmlMap (com.gargoylesoftware.htmlunit.html.HtmlMap)1 JsxGetter (com.gargoylesoftware.htmlunit.javascript.configuration.JsxGetter)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1