You are here

protected function DOMTreeBuilder::autoclose 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::autoclose()

Automatically climb the tree and close the closest node with the matching $tag.

2 calls to DOMTreeBuilder::autoclose()
DOMTreeBuilder::endTag in vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php
An end-tag.
DOMTreeBuilder::startTag in vendor/masterminds/html5/src/HTML5/Parser/DOMTreeBuilder.php
Process the start tag.

File

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

Class

DOMTreeBuilder
Create an HTML5 DOM tree from events.

Namespace

Masterminds\HTML5\Parser

Code

protected function autoclose($tag) {
  $working = $this->current;
  do {
    if ($working->nodeType != XML_ELEMENT_NODE) {
      return false;
    }
    if ($working->tagName == $tag) {
      $this->current = $working->parentNode;
      return true;
    }
  } while ($working = $working->parentNode);
  return false;
}