You are here

protected function DOMTreeBuilder::isAncestor in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php \Masterminds\HTML5\Parser\DOMTreeBuilder::isAncestor()

Checks if the given tagname is an ancestor of the present candidate.

If $this->current or anything above $this->current matches the given tag name, this returns true.

File

vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php, line 664

Class

DOMTreeBuilder
Create an HTML5 DOM tree from events.

Namespace

Masterminds\HTML5\Parser

Code

protected function isAncestor($tagname) {
  $candidate = $this->current;
  while ($candidate->nodeType === XML_ELEMENT_NODE) {
    if ($candidate->tagName == $tagname) {
      return true;
    }
    $candidate = $candidate->parentNode;
  }
  return false;
}