All Downloads are FREE. Search and download functionalities are using the official Maven repository.

js.web.dom.NodeList Maven / Gradle / Ivy

package js.web.dom;

import js.util.collections.ArrayLike;
import js.util.collections.IntKeyValue;
import js.util.function.IntKeyConsumer;
import js.util.iterable.IntIterableIterator;
import js.util.iterable.IterableIterator;
import org.teavm.jso.JSBody;
import org.teavm.jso.JSProperty;

import javax.annotation.Nullable;

/**
 * NodeList objects are collections of nodes, usually returned by properties such as Node.childNodes and methods such as document.querySelectorAll().
 */
public interface NodeList extends ArrayLike {
    @JSBody(script = "return NodeList.prototype")
    static NodeList prototype() {
        throw new UnsupportedOperationException("Available only in JavaScript");
    }

    @JSBody(script = "return new NodeList()")
    static NodeList create() {
        throw new UnsupportedOperationException("Available only in JavaScript");
    }

    /**
     * Returns the number of nodes in the collection.
     */
    @JSProperty
    int getLength();

    /**
     * Returns the node with index index from the collection. The nodes are sorted in tree order.
     */
    @Nullable
    Node item(int index);

    /**
     * Performs the specified action for each node in an list.
     *
     * @param callbackfn A function that accepts up to three arguments. forEach calls the callbackfn function one time for each element in the list.
     */
    void forEach(IntKeyConsumer callbackfn);

    /**
     * Returns an array of key, value pairs for every entry in the list.
     */
    IterableIterator> entries();

    /**
     * Returns an list of keys in the list.
     */
    IntIterableIterator keys();

    /**
     * Returns an list of values in the list.
     */
    IterableIterator values();

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy