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

Breadcrumb

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

function Traverser::walk

Tell the traverser to walk the DOM.

Return value

resource $out Returns the output stream.

File

vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php, line 61

Class

Traverser
Traverser for walking a DOM tree.

Namespace

Masterminds\HTML5\Serializer

Code

public function walk() {
    if ($this->dom instanceof \DOMDocument) {
        $this->rules
            ->document($this->dom);
    }
    elseif ($this->dom instanceof \DOMDocumentFragment) {
        // Document fragments are a special case. Only the children need to
        // be serialized.
        if ($this->dom
            ->hasChildNodes()) {
            $this->children($this->dom->childNodes);
        }
    }
    elseif ($this->dom instanceof \DOMNodeList) {
        // If this is a NodeList of DOMDocuments this will not work.
        $this->children($this->dom);
    }
    else {
        $this->node($this->dom);
    }
    return $this->out;
}

API Navigation

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