Examples of JsNodeArray


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

  /**
   * Removes the specified Element from the set of matched elements. This method is used to remove a
   * single Element from a jQuery object.
   */
  public GQuery not(Element elem) {
    JsNodeArray array = JsNodeArray.create();
    for (Element e : elements) {
      if (e != elem) {
        array.addNode(e);
      }
    }
    return $(array);
  }
View Full Code Here

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

  /**
   * Get a set of elements containing the unique parents of the matched set of elements.
   */
  public GQuery parent() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Element p = e.getParentElement();
      if (p != null) {
        result.addNode(p);
      }
    }
    return new GQuery(unique(result));
  }
View Full Code Here

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

   * Get the ancestors of each element in the current set of matched elements, up to but not
   * including the element matched by the selector.
   *
   */
  public GQuery parentsUntil(String selector) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Node par = e.getParentNode();
      while (par != null && par != document) {
        if (selector != null && $(par).is(selector)) {
          break;
        }
        result.addNode(par);
        par = par.getParentNode();
      }
    }
    return new GQuery(unique(result)).setPreviousObject(this);
  }
View Full Code Here

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

  /**
   * Get a set of elements containing the unique previous siblings of each of the matched set of
   * elements. Only the immediately previous sibling is returned, not all previous siblings.
   */
  public GQuery prev() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Element next = getPreviousSiblingElement(e);
      if (next != null) {
        result.addNode(next);
      }
    }
    return new GQuery(unique(result));
  }
View Full Code Here

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

   * Get a set of elements containing the unique previous siblings of each of the matched set of
   * elements filtered by selector. Only the immediately previous sibling is returned, not all
   * previous siblings.
   */
  public GQuery prev(String... selectors) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      Element next = getPreviousSiblingElement(e);
      if (next != null) {
        result.addNode(next);
      }
    }
    return new GQuery(unique(result)).filter(selectors);
  }
View Full Code Here

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

  /**
   * Get all preceding siblings of each element in the set of matched elements filtered by a
   * selector.
   */
  public GQuery prevAll(String selector) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allPreviousSiblingElements(getPreviousSiblingElement(e), result, null, selector);
    }
    return pushStack(unique(result), "prevAll", getSelector());
  }
View Full Code Here

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

   * Get all preceding siblings of each element matching the <code>filter</code> up to but not
   * including the element matched by the <code>until</code> element.
   *
   */
  public GQuery prevUntil(GQuery until, String filter) {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allPreviousSiblingElements(getPreviousSiblingElement(e), result, until, filter);
    }
    return pushStack(unique(result), "prevUntil", getSelector());
  }
View Full Code Here

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

  /**
   * Get a set of elements containing all of the unique siblings of each of the matched set of
   * elements.
   */
  public GQuery siblings() {
    JsNodeArray result = JsNodeArray.create();
    for (Element e : elements) {
      allNextSiblingElements(e.getParentElement().getFirstChildElement(), result, e, null, null);
    }
    return new GQuery(unique(result));
  }
View Full Code Here

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

  /**
   * Selects a subset of the matched elements.
   */
  public GQuery slice(int start, int end) {
    JsNodeArray slice = JsNodeArray.create();
    int l = size();
    if (end == -1 || end > l) {
      end = l;
    }
    for (int i = start; i < end; i++) {
      slice.addNode(get(i));
    }
    return new GQuery(slice);
  }
View Full Code Here

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

    a.put("obj", new Long(21));
    assertEquals(1, a.length());
    assertEquals(1, a.keys().length);
    assertEquals(1, a.elements().length);

    JsNodeArray n = JsNodeArray.create();
    assertEquals(0, n.getLength());
    assertEquals(0, n.<JsCache>cast().keys().length);
    assertEquals(0, n.elements().length);

    n.addNode($("<hr/>").get(0));
    assertEquals(1, n.getLength());
    assertEquals(1, n.<JsCache>cast().keys().length);
    assertEquals(1, n.elements().length);
  }
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.