You are here

protected function OutputRules::openTag 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::openTag()

Write the opening tag.

Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the qualified name (8.3).

Parameters

\DOMNode $ele: The element being written.

1 call to OutputRules::openTag()
OutputRules::element in vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php
Write an element.

File

vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php, line 309
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 openTag($ele) {
  $this
    ->wr('<')
    ->wr($this->traverser
    ->isLocalElement($ele) ? $ele->localName : $ele->tagName);
  $this
    ->attrs($ele);
  $this
    ->namespaceAttrs($ele);
  if ($this->outputMode == static::IM_IN_HTML) {
    $this
      ->wr('>');
  }
  else {
    if ($ele
      ->hasChildNodes()) {
      $this
        ->wr('>');
    }
    else {
      $this
        ->wr(' />');
    }
  }
}