/** * Remove all duplicate elements from an array of elements. Note that this only works on arrays of * DOM elements, not strings or numbers. */ public JsNodeArray unique(NodeList<Element> result) { return JsUtils.unique(result.<JsArray<Element>> cast()).cast(); }
@PatchMethod static NodeList<TableRowElement> getRows(TableSectionElement e) { // deep search return e.getElementsByTagName("tr").cast(); } }
@PatchMethod static NodeList<TableRowElement> getRows(TableElement e) { // deep search return e.getElementsByTagName("tr").cast(); }
@PatchMethod static NodeList<TableRowElement> getRows(TableElement e) { // deep search return e.getElementsByTagName("tr").cast(); }
@PatchMethod static NodeList<TableRowElement> getRows(TableSectionElement e) { // deep search return e.getElementsByTagName("tr").cast(); } }
@PatchMethod static NodeList<TableCellElement> getCells(TableRowElement element) { return element.getChildNodes().<NodeList<TableCellElement>>cast(); }
@PatchMethod static NodeList<TableCellElement> getCells(TableRowElement element) { return element.getChildNodes().<NodeList<TableCellElement>>cast(); }
@PatchMethod static NodeList<TableSectionElement> getTBodies(TableElement e) { return getElementByTagName(e, "tbody").cast(); }
@PatchMethod static NodeList<TableSectionElement> getTBodies(TableElement e) { return getElementByTagName(e, "tbody").cast(); }
private NodeList<Element> getTableHeads() { return tbody.getFirstChildElement().getChildNodes().cast(); }
/** * Removes all elements from the set of matched elements that do not pass the specified css * expression. This method is used to narrow down the results of a search. * Setting considerDetached parameter to true, means that we should consider detached elements * as well which implies some performance penalties. */ public GQuery filter(boolean filterDetached, String selector) { if (selector.isEmpty()) { return this; } JsNodeArray result = getSelectorEngine().filter(nodeList, selector, filterDetached).cast(); return pushStack(result, "filter", selector); }
public Element getJointElement(TreeNode node) { if (node.joint == null) { node.joint = ((NodeList<Element>) getElementContainer(node).getChildNodes().cast()).getItem(1); } return node.joint; }
/** * Removes all elements from the set of matched elements that do not match the specified function. * The function is called with a context equal to the current element. If the function returns * false, then the element is removed - anything else and the element is kept. */ public GQuery filter(Predicate filterFn) { JsNodeArray result = getSelectorEngine().filter(nodeList, filterFn).cast(); return pushStack(result, "filter", currentSelector); }
public Element getCheckElement(TreeNode node) { if (node.check == null) { node.check = getElementContainer(node) != null ? ((NodeList<Element>) getElementContainer(node).getChildNodes().cast()).getItem(2) : null; } return node.check; }
public Element getIconElement(TreeNode node) { if (node.icon == null) { node.icon = getElementContainer(node) != null ? ((NodeList<Element>) getElementContainer(node).getChildNodes().cast()).getItem(3) : null; } return node.icon; }
/** * Removes all elements from the set of matched elements that do not pass the specified css * expression. This method is used to narrow down the results of a search. * Setting filterDetached parameter to true, means that we should consider detached elements * as well which implies some performance penalty. */ public GQuery filter(boolean filterDetached, String... filters) { String selector = join(", ", filters); JsNodeArray result = getSelectorEngine().filter(nodeList, selector, filterDetached).cast(); return pushStack(result, "filter", selector); }
public Element getTextElement(TreeNode node) { if (node.text == null) { node.text = getElementContainer(node) != null ? ((NodeList<Element>) getElementContainer(node).getChildNodes().cast()).getItem(4) : null; } return node.text; }
/** * Removes all elements from the set of matched elements that do not pass the specified css * expression. This method is used to narrow down the results of a search. * By default it works for either detached and attached elements unless * {@link SelectorEngine#filterDetached} is set to false. */ public GQuery filter(String... filters) { String selector = join(", ", filters); JsNodeArray result = getSelectorEngine().filter(nodeList, selector).cast(); return pushStack(result, "filter", selector); }
protected NodeList<Element> getRows() { if (!hasRows()) { return new JsArray().getJsObject().cast(); } return mainBody.dom.getChildNodes().cast(); }
/** * Add elements to the set of matched elements if they are not included yet. * * It construct a new GQuery object and does not modify the original ones. * * It also update the selector appending the new one. */ public GQuery add(GQuery elementsToAdd) { return pushStack(JsUtils.copyNodeList(nodeList, elementsToAdd.nodeList, true) .<JsNodeArray> cast(), "add", join(",", getSelector(), elementsToAdd.getSelector())); }