@Override public Iterator<HTMLElement> iterator() { return Elements.iterator(elements); } }
/** * Returns a predicate for {@linkplain HTMLElement HTML elements}. Useful in streams of {@linkplain Node nodes} or * {@linkplain Element elements}. */ public static <T extends Node> Predicate<T> htmlElements() { return new FilterHTMLElements<>(); }
/** * Registers a callback when an element is removed from the document body. Note that the callback will be called * only once, if the element is removed and re-appended a new callback should be registered. * * @param element the HTML element which is going to be removed from the body * @param callback {@link ObserverCallback} */ public static void onDetach(HTMLElement element, ObserverCallback callback) { if (element != null) { BodyObserver.addDetachObserver(element, callback); } }
public Style(T element) { this.element = element.asElement(); this.wrapperElement = element; }
/** Returns a builder for the specified empty tag. */ public static <E extends HTMLElement> EmptyContentBuilder<E> emptyElement(String tag, Class<E> type) { return emptyElement(() -> createElement(tag, type)); }
/** * Creates and returns the element on demand by calling {@link #createElement()} or just returns the previously * created element. */ @Override public HTMLElement element() { if (element == null) { element = createElement(); } return element; }
/** * Removes the element from its parent if the element is not null and has a parent. * * @return {@code true} if the the element has been removed from its parent, {@code false} otherwise. */ public static boolean failSafeRemoveFromParent(Element element) { return failSafeRemove(element != null ? element.parentNode : null, element); }
/** * Registers a callback when an element is appended to the document body. Note that the callback will be called * only once, if the element is appended more than once a new callback should be registered. * * @param element the HTML element which is going to be added to the body * @param callback {@link ObserverCallback} */ public static void onAttach(HTMLElement element, ObserverCallback callback) { if (element != null) { BodyObserver.addAttachObserver(element, callback); } }
/** * Casts to {@link HTMLElement}. Make sure to {@linkplain #htmlElements() filter} for HTML elements before using * this function. */ public static <T extends Node> Function<T, HTMLElement> asHtmlElement() { return new AsHTMLElement<>(); }
public static HtmlContentBuilder<HTMLFieldSetElement> fieldset() { return htmlElement("fieldset", HTMLFieldSetElement.class); }
public HtmlComponentBuilder(T component) { super(component.asElement()); this.component = component; }
/** Returns an iterable collection for the child elements of the given parent element. */ public static Iterable<HTMLElement> children(HTMLElement parent) { return () -> iterator(parent); }
public Style(T element) { this.element = element.asElement(); this.wrapperElement = element; }
/** Returns an iterable collection for the child nodes of the given parent node. */ public static Iterable<Node> children(Node parent) { return () -> iterator(parent); }
public HtmlComponentBuilder(T component) { super(component.asElement()); this.component = component; }
/** Returns an iterable collection for the elements in the given array-like. */ public static <E> Iterable<E> elements(JsArrayLike<E> nodes) { return () -> iterator(nodes); }
public SelectionPlugin(ColorScheme colorScheme, IsElement singleSelectIndicator) { this(colorScheme, singleSelectIndicator.asElement()); }