use of com.gargoylesoftware.htmlunit.html.HtmlArea 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_;
}
use of com.gargoylesoftware.htmlunit.html.HtmlArea in project htmlunit by HtmlUnit.
the class HTMLAreaElement method focus.
/**
* Sets the focus to this element.
*/
@Override
public void focus() {
// in reality this depends also on the visibility of the area itself
final HtmlArea area = (HtmlArea) getDomNodeOrDie();
final String hrefAttr = area.getHrefAttribute();
if (ATTRIBUTE_NOT_DEFINED != hrefAttr || getBrowserVersion().hasFeature(JS_AREA_WITHOUT_HREF_FOCUSABLE)) {
area.focus();
}
}
Aggregations