summaryrefslogtreecommitdiff
path: root/src/HTML5
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-06 08:30:52 -0400
committerMatt Farina <[email protected]>2013-05-06 08:30:52 -0400
commite4e5007558bf2e6c0add4703a1c4d937c65acfc5 (patch)
tree9101e96432186a5aedcfdfeecf66bfc762732ec3 /src/HTML5
parent4c6606b13b7d8994a4db4735d3b4fa99fac78b3f (diff)
Added some commenting on the operation of the traverser.
Diffstat (limited to 'src/HTML5')
-rw-r--r--src/HTML5/Serializer/Traverser.php25
1 files changed, 25 insertions, 0 deletions
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('>');