From e4e5007558bf2e6c0add4703a1c4d937c65acfc5 Mon Sep 17 00:00:00 2001 From: Matt Farina Date: Mon, 6 May 2013 08:30:52 -0400 Subject: Added some commenting on the operation of the traverser. --- src/HTML5/Serializer/Traverser.php | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'src/HTML5') diff --git a/src/HTML5/Serializer/Traverser.php b/src/HTML5/Serializer/Traverser.php index 5648dd1..097162e 100644 --- a/src/HTML5/Serializer/Traverser.php +++ b/src/HTML5/Serializer/Traverser.php @@ -105,7 +105,14 @@ class Traverser { $this->nl(); } + /** + * Process a node in the DOM. + * + * @param mixed $node + * A node implementing \DOMNode. + */ protected function node($node) { + // A listing of types is at http://php.net/manual/en/dom.constants.php switch ($node->nodeType) { case XML_ELEMENT_NODE: $this->element($node); @@ -188,6 +195,15 @@ class Traverser { } } + /** + * Write the opening tag. + * + * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the + * qualified name (8.3). + * + * @param \DOMNode $ele + * The element being written. + */ protected function openTag($ele) { // FIXME: Needs support for SVG, MathML, and namespaced XML. $this->wr('<')->wr($ele->tagName); @@ -217,6 +233,15 @@ class Traverser { } } + /** + * Write the closing tag. + * + * Tags for HTML, MathML, and SVG are in the local name. Otherwise, use the + * qualified name (8.3). + * + * @param \DOMNode $ele + * The element being written. + */ protected function closeTag($ele) { // FIXME: Needs support for SVG, MathML, and namespaced XML. $this->wr('wr($ele->tagName)->wr('>'); -- cgit v1.2.3