You are here

protected function OutputRules::namespaceAttrs in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php \Masterminds\HTML5\Serializer\OutputRules::namespaceAttrs()

Write the namespace attributes

Parameters

\DOMNode $ele: The element being written.

1 call to OutputRules::namespaceAttrs()
OutputRules::openTag in vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php
Write the opening tag.

File

vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php, line 287
The rules for generating output in the serializer.

Class

OutputRules
Generate the output html5 based on element rules.

Namespace

Masterminds\HTML5\Serializer

Code

protected function namespaceAttrs($ele) {
  if (!$this->xpath || $this->xpath->document !== $ele->ownerDocument) {
    $this->xpath = new \DOMXPath($ele->ownerDocument);
  }
  foreach ($this->xpath
    ->query('namespace::*[not(.=../../namespace::*)]', $ele) as $nsNode) {
    if (!in_array($nsNode->nodeValue, $this->implicitNamespaces)) {
      $this
        ->wr(' ')
        ->wr($nsNode->nodeName)
        ->wr('="')
        ->wr($nsNode->nodeValue)
        ->wr('"');
    }
  }
}