Returns true if ancestor is an ancestor of or equal to descendant, false
otherwise.
977858
function isAncestorContainer(ancestor, descendant) {
	return (ancestor || descendant)
		&& (ancestor == descendant || isAncestor(ancestor, descendant));
}
615777
function ancestor(node, visitors, base, state) {
  if (!base) base = exports.base;
  if (!state) state = [];(function c(node, st, override) {
    var type = override || node.type,
        found = visitors[type];
    if (node != st[st.length - 1]) {
      st = st.slice();
      st.push(node);
    }
    base[type](node, st, c);
    if (found) found(node, st);
  })(node, state);
}
1213437
function getDepth(ancestor, descendant) {
      var ret = 0;
      while (descendant !== ancestor) {
          ret++;
          descendant = descendant.parentNode;
          if (!descendant)
              throw new Error("not a descendant of ancestor!");
      }
      return ret;
  }
1226627
def is_descendant_of(self, other, include_self=False):
        """"""
        if other.pk == self.pk:
            return include_self

        return self._closure_model.objects.filter(
            parent=other,
            child=self
        ).exclude(pk=self.pk).exists()
834221
private boolean checkParents( boolean exclusive ) {
        if (path.equals("/")) {
            return true;
        }
        if (owner == null) {
            // no owner, checking parents
            return parent != null && parent.checkParents(exclusive);
        }
        // there already is a owner
        return !(this.exclusive || exclusive) && parent.checkParents(exclusive);
    }
82694
public function hasAncestor($ancestor)
    {
        if (!$this->hasParent()) {
            return false;
        }
        if ($this->parent->getRefId() == $ancestor->getRefId()) {
            return true;
        }
        return $this->parent->hasAncestor($ancestor);
    }
35287
public boolean isBelow( PlanNode possibleAncestor ) {
        PlanNode node = this;
        while (node != null) {
            if (node == possibleAncestor) return true;
            node = node.getParent();
        }
        return false;
    }
43649
function findAncestor(node, predicate) {
  var last = false;
  while (node != null && !(last = predicate(node))) {
    node = node.parentNode;
  }
  return last ? node : null;
}
542202
def is_descendant_of(self, node):
        
        return self.pk in [obj.pk for obj in node.get_descendants()]
782938
def is_descendant_of(self, node):
        
        return (
            self.tree_id == node.tree_id and
            self.lft > node.lft and
            self.rgt < node.rgt
        )
643063
public static <T> boolean isDescendantOfOrEqualTo(TreeDef.Parented<T> treeDef, T child, T parent) {
		if (child.equals(parent)) {
			return true;
		} else {
			return isDescendantOf(treeDef, child, parent);
		}
	}
441115
private boolean isNormal() {
    if (getNameCount() == 0 || (getNameCount() == 1 && !isAbsolute())) {
      return true;
    }

    boolean foundNonParentName = isAbsolute(); // if there's a root, the path doesn't start with ..
    boolean normal = true;
    for (Name name : names) {
      if (name.equals(Name.PARENT)) {
        if (foundNonParentName) {
          normal = false;
          break;
        }
      } else {
        if (name.equals(Name.SELF)) {
          normal = false;
          break;
        }

        foundNonParentName = true;
      }
    }
    return normal;
  }
676665
def ancestors
        a = Array.new
        self.parent._ancestors(a) unless self.parent.nil?
        return a
    end
204159
public boolean isAncestor(XMLNode node) {
		return node == parent || (parent != null && parent.isAncestor(node));
	}
1121903
public function isSection() {
		if ($this->isCurrent()) {
			return true;
		}
		$ancestors = $this->getAncestors();
		if (Director::get_current_page() instanceof Page) {
			$node = Director::get_current_page()->asMenuItem();
			if ($node) {
				$ancestors = $node->getAncestors();
				return $ancestors && in_array($this->ID, $node->getAncestors()->column());
			}
			
		}
		return false;
	}
1243797
function isAtruleDescendant(node) {
  let { parent } = node;
  let descended = false;

  while (parent && parent.type !== 'root') {
    if (parent.type === 'atrule') {
      descended = parent.params;
    }
    parent = parent.parent;
  }
  return descended;
}
1359446
function isLeftEdgeOf(node, ancestor) {
  while (node && node !== ancestor) {
    if (position(node) !== 0) {
      return false;
    }
    node = node.parentNode;
  }

  return true;
}