Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DOMTreeBuilder.php

function DOMTreeBuilder::autoclose

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

Parameters

string $tagName:

Return value

bool

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 664

Class

DOMTreeBuilder
Create an HTML5 DOM tree from events.

Namespace

Masterminds\HTML5\Parser

Code

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

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal