// Per spec:
// If the element has a declared namespace in the HTML, MathML or
// SVG namespaces, we use the lname instead of the tagName.
if ($this->traverser->
isLocalElement($ele)) { $name =
$ele->localName;
} // If we are in SVG or MathML there is special handling.
// Using if/elseif instead of switch because it's faster in PHP.
if ('svg' ==
$name) { $this->outputMode =
static::IM_IN_SVG;
$name = Elements::
normalizeSvgElement($name);
} elseif ('math' ==
$name) { $this->outputMode =
static::IM_IN_MATHML;
} $this->
openTag($ele);
if (Elements::
isA($name, Elements::TEXT_RAW
)) { foreach ($ele->childNodes
as $child) { if ($child instanceof \DOMCharacterData
) { $this->
wr($child->data
);
} elseif ($child instanceof \DOMElement
) { $this->
element($child);
}