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

Breadcrumb

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

function DOMTreeBuilder::processingInstruction

Overrides EventHandler::processingInstruction

File

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

Class

DOMTreeBuilder
Create an HTML5 DOM tree from events.

Namespace

Masterminds\HTML5\Parser

Code

public function processingInstruction($name, $data = null) {
    // XXX: Ignore initial XML declaration, per the spec.
    if ($this->insertMode === static::IM_INITIAL && 'xml' === strtolower($name)) {
        return;
    }
    // Important: The processor may modify the current DOM tree however it sees fit.
    if ($this->processor instanceof InstructionProcessor) {
        $res = $this->processor
            ->process($this->current, $name, $data);
        if (!empty($res)) {
            $this->current = $res;
        }
        return;
    }
    // Otherwise, this is just a dumb PI element.
    $node = $this->doc
        ->createProcessingInstruction($name, $data);
    $this->current
        ->appendChild($node);
}

API Navigation

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