Search in sources :

Example 1 with BodyFilter

use of org.loboevolution.html.dom.filter.BodyFilter in project LoboEvolution by LoboEvolution.

the class WindowImpl method getLength.

/**
 * {@inheritDoc}
 */
@Override
public int getLength() {
    if (this.lengthSet) {
        return this.length;
    } else {
        final HTMLDocumentImpl doc = this.document;
        final List<Node> list = new LinkedList<>(Arrays.asList(doc.getNodeList(new BodyFilter()).toArray()));
        HTMLCollection collection = new HTMLCollectionImpl(doc, list);
        return collection.getLength();
    }
}
Also used : HTMLCollection(org.loboevolution.html.dom.HTMLCollection) BodyFilter(org.loboevolution.html.dom.filter.BodyFilter)

Example 2 with BodyFilter

use of org.loboevolution.html.dom.filter.BodyFilter in project LoboEvolution by LoboEvolution.

the class HTMLDocumentImpl method getBody.

/**
 * {@inheritDoc}
 */
@Override
public HTMLElement getBody() {
    synchronized (this) {
        if (this.body == null) {
            final List<Node> list = new LinkedList<>(Arrays.asList(this.getNodeList(new BodyFilter()).toArray()));
            HTMLCollection collection = new HTMLCollectionImpl(this, list);
            if (collection.getLength() > 0) {
                return (HTMLElement) collection.item(0);
            } else {
                return null;
            }
        }
        return this.body;
    }
}
Also used : HTMLCollection(org.loboevolution.html.dom.HTMLCollection) HTMLElement(org.loboevolution.html.dom.HTMLElement) Node(org.loboevolution.html.node.Node) BodyFilter(org.loboevolution.html.dom.filter.BodyFilter)

Aggregations

HTMLCollection (org.loboevolution.html.dom.HTMLCollection)2 BodyFilter (org.loboevolution.html.dom.filter.BodyFilter)2 HTMLElement (org.loboevolution.html.dom.HTMLElement)1 Node (org.loboevolution.html.node.Node)1