Finds another node by a CSS selector relative to the current node.
342504
def css(self, css):
    
    return [self.get_node_factory().create(node_id)
            for node_id in self._get_css_ids(css).split(",")
            if node_id]
497946
def href_of(scope, selector)
      if node = scope.css(selector).first
        node.attr('href')
      end
    end
944427
function findPrevRowNode(node){
	var i, last, prev,
		parent = node.parent,
		siblings = parent ? parent.children : null;

	if(siblings && siblings.length > 1 && siblings[0] !== node){
		// use the lowest descendant of the preceeding sibling
		i = $.inArray(node, siblings);
		prev = siblings[i - 1];
		_assert(prev.tr);
		// descend to lowest child (with a <tr> tag)
		while(prev.children){
			last = prev.children[prev.children.length - 1];
			if(!last.tr){
				break;
			}
			prev = last;
		}
	}else{
		// if there is no preceding sibling, use the direct parent
		prev = parent;
	}
	return prev;
}
791582
function findAll(el, selector) {
  if (!selector) {
    selector = el;
    el = document;
  }
  return el.querySelectorAll(selector);
}
1093593
def closest(self):
        """"""

        current = self.tag
        closest = None
        while closest is None and current is not None:
            if self.match(current):
                closest = current
            else:
                current = self.get_parent(current)
        return closest
781255
function(selector) {

	var allMatches = localnwt.all(selector),
		testNode = this._node,
		ancestor = null,
		maxDepth = 0;

	if( allMatches.size() == 0 ) {
		return null;
	}

	while( true ) {

		// Iterate through all matches for each parent, and exit as soon as we have a match
		// Pretty bad performance, but super small. TODO: Omtimize
		allMatches.each(function (el) {
			if (el._node == testNode) {
				ancestor = el;
			}
		});

		var parentNode = testNode.parentNode;

		if( ancestor || !parentNode) { break; }
		testNode = parentNode;
	}

	if( ancestor ) {
		return ancestor;
	} else {
		return null;
	}
}
802821
def follow_link_by_selector(self, selector):
    
    elem = find_element_by_jquery(world.browser, selector)
    href = elem.get_attribute('href')
    world.browser.get(href)
424634
def with(selector)
            @selectors[selector] = Selector.new selector unless @selectors.has_key? selector
            yield @current_node if @selectors[selector].matches? @current_node, @filtered_nodes
        end
1196069
def css(self, css_path, dom=None):
        """"""
        if dom is None:
            dom = self.browser
        return expect(dom.find_by_css, args=[css_path])
542023
def find(self, node, path):
        """"""

        return node.find(path, namespaces=self.namespaces)
874359
function closest(node, parentSelector) {
  var cursor = node;

  if (!parentSelector || typeof parentSelector !== 'string') {
    throw new Error('Please specify a selector to match against!');
  }

  while (cursor && !matches(cursor, parentSelector)) {
    cursor = cursor.parentNode;
  }

  if (!cursor) {
    return null;
  } else {
    return cursor;
  }
}
1929
function(el, prevSelector) {

        var selector;

        if (el === this.el) {
            if (typeof prevSelector === 'string') selector = '> ' + prevSelector;
            return selector;
        }

        if (el) {

            var nthChild = V(el).index() + 1;
            selector = el.tagName + ':nth-child(' + nthChild + ')';

            if (prevSelector) {
                selector += ' > ' + prevSelector;
            }

            selector = this.getSelector(el.parentNode, selector);
        }

        return selector;
    }
31400
def next_element(element, name = nil)
      if siblings = element.parent.children
        found = false
        siblings.each do |node|
          if node.equal?(element)
            found = true
          elsif found && node.tag?
            return node if (name.nil? || node.name == name)
          end
        end
      end
      nil
    end
923388
def find_node(self, x: int, y: int) -> Optional["BSP"]:
        
        if not self.contains(x, y):
            return None
        for child in self.children:
            found = child.find_node(x, y)  # type: Optional["BSP"]
            if found:
                return found
        return self
509881
def is_sibling_of(self, node):
        
        return self.get_siblings().filter(pk=node.pk).exists()
774109
function findParent(node) {
  // TODO: It may be a good idea to cache this to prevent unnecessary DOM
  // traversal, but caching is difficult to do correctly without using a
  // mutation observer to listen for all DOM changes.
  var nodeID = ReactMount.getID(node);
  var rootID = ReactInstanceHandles.getReactRootIDFromNodeID(nodeID);
  var container = ReactMount.findReactContainerForID(rootID);
  var parent = ReactMount.getFirstReactDOM(container);
  return parent;
}
665308
def previous_element(name = nil)
      if siblings = parent.children
        found = nil
        siblings.each do |node|
          return found if node.equal?(self)
          found = node if node.tag? && (name.nil? || node.name == name)
        end
      end
      nil
    end