Exemplo n.º 1
0
  /**
   * Get general sibling elements.
   *
   * @see <a href="http://www.w3.org/TR/css3-selectors/#general-sibling-combinators">General sibling
   *     combinator</a>
   */
  private void getGeneralSiblingElements() {
    for (Branch node : nodes) {
      Branch n = DOMHelper.getNextSiblingElement(node);
      while (n != null) {
        if (selector.getTagName().equals(n.getName())
            || selector.getTagName().equals(Selector.UNIVERSAL_TAG)) {
          result.add(n);
        }

        n = DOMHelper.getNextSiblingElement(n);
      }
    }
  }
Exemplo n.º 2
0
 /**
  * Get adjacent sibling elements.
  *
  * @see <a href="http://www.w3.org/TR/css3-selectors/#adjacent-sibling-combinators">Adjacent
  *     sibling combinator</a>
  */
 private void getAdjacentSiblingElements() {
   String tag = selector.getTagName();
   for (Branch node : nodes) {
     Branch n = DOMHelper.getNextSiblingElement(node);
     if (n != null) {
       if (tag.equals(n.getName()) || tag.equals(Selector.UNIVERSAL_TAG)) {
         result.add(n);
       }
     }
   }
 }