Examples of JsNodeArray


Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Filter the set of elements to those that contain the specified text.
   */
  public GQuery contains(String text) {
    JsNodeArray array = JsNodeArray.create();
    for (Element e : elements) {
      if ($(e).text().contains(text)) {
        array.addNode(e);
      }
    }
    return $(array);
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Find all the child nodes inside the matched elements (including text nodes), or the content
   * document, if the element is an iframe.
   */
  public GQuery contents() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      if (JsUtils.isWindow(e) || "iframe".equalsIgnoreCase(e.getTagName())) {
        result.addNode(getStyleImpl().getContentDocument(e));
      } else {
        NodeList<Node> children = e.getChildNodes();
        for (int i = 0, l = children.getLength(); i < l; i++) {
          result.addNode(children.getItem(i));
        }
      }
    }
    return new GQuery(unique(result));
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  public GQuery die(String eventName) {
    return as(Events).die(eventName);
  }

  private GQuery domManip(GQuery g, DomMan type, Element... elms) {
    JsNodeArray newNodes = JsNodeArray.create();
    if (elms.length == 0) {
      elms = elements;
    }
    for (int i = 0, l = elms.length; i < l; i++) {
      Element e = elms[i];
      if (e.getNodeType() == Node.DOCUMENT_NODE) {
        e = e.<Document> cast().getBody();
      }
      for (int j = 0, size = g.size(); j < size; j++) {
        // Widget w = getAssociatedWidget(g.get(j));
        // GqUi.detachWidget(w);

        Node n = g.get(j);
        // If an element selected is inserted elsewhere, it will be moved into the target (not
        // cloned).
        // If there is more than one target element, however, cloned copies of the inserted element
        // will be created for each target after the first
        if (i > 0) {
          n = n.cloneNode(true);
        }
        switch (type) {
          case PREPEND:
            newNodes.addNode(e.insertBefore(n, e.getFirstChild()));
            break;
          case APPEND:
            newNodes.addNode(e.appendChild(n));
            break;
          case AFTER:
            newNodes.addNode(e.getParentNode().insertBefore(n, e.getNextSibling()));
            break;
          case BEFORE:
            newNodes.addNode(e.getParentNode().insertBefore(n, e));
            break;
        }
        EventsListener.rebind(n.<Element> cast());
        // GqUi.attachWidget(w);
      }
    }
    // TODO: newNodes.size() > g.size() makes testRebind fail
    if (newNodes.size() >= g.size()) {
      g.setArray(newNodes);
    }
    return this;
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   * 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 = JsNodeArray.create();
    int i = 0;
    for (Element e : elements) {
      if (filterFn.f(e, i++)) {
        result.addNode(e);
      }
    }
    return pushStack(result, "filter", currentSelector);
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  public GQuery filter(String... filters) {
    if (filters.length == 0 || filters[0] == null) {
      return this;
    }

    JsNodeArray array = JsNodeArray.create();

    for (String f : filters) {
      for (Element e : elements) {
        boolean ghostParent = false;
        if (e == window || e.getNodeName() == null) {
          continue;
        }
        if (e.getParentNode() == null) {
          DOM.createDiv().appendChild(e);
          ghostParent = true;
        }

        for (Element c : $(f, e.getParentNode()).elements) {
          if (c == e) {
            array.addNode(c);
            break;
          }
        }

        if (ghostParent) {
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   * find additional descendant elements with which to process.
   *
   * Provide a comma-separated list of expressions to apply multiple filters at once.
   */
  public GQuery find(String... filters) {
    JsNodeArray array = JsNodeArray.create();
    for (String selector : filters) {
      for (Element e : elements) {
        for (Element c : $(selector, e).elements) {
          array.addNode(c);
        }
      }
    }
    return pushStack(unique(array), "find", filters[0]);
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Get a set of elements containing the unique next siblings of each of the given set of elements.
   * next only returns the very next sibling for each element, not all next siblings see {#nextAll}.
   */
  public GQuery next() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Element next = e.getNextSiblingElement();
      if (next != null) {
        result.addNode(next);
      }
    }
    return pushStack(unique(result), "next", getSelector());
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   * Get a set of elements containing the unique next siblings of each of the given set of elements
   * filtered by 1 or more selectors. next only returns the very next sibling for each element, not
   * all next siblings see {#nextAll}.
   */
  public GQuery next(String... selectors) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Element next = e.getNextSiblingElement();
      if (next != null) {
        result.addNode(next);
      }
    }
    return pushStack(result, "next", selectors[0]).filter(selectors);
  }
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

  /**
   * Get all following siblings of each element in the set of matched elements, filtered by a
   * selector.
   */
  public GQuery nextAll(String filter) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allNextSiblingElements(e.getNextSiblingElement(), result, null, null, filter);
    }

    return pushStack(unique(result), "nextAll", getSelector());
View Full Code Here

Examples of com.google.gwt.query.client.js.JsNodeArray

   * GQuery object, filtered by a selector
   *
   * @return
   */
  public GQuery nextUntil(GQuery until, String filter) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allNextSiblingElements(e.getNextSiblingElement(), result, null, until, filter);
    }
    return pushStack(unique(result), "nextUntil", getSelector());
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.