summaryrefslogtreecommitdiff
path: root/src/HTML5/Serializer
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-06-26 09:10:47 -0400
committerMatt Farina <[email protected]>2013-06-26 09:10:47 -0400
commite1978e35fc16007620866de2713f05d0dbefb470 (patch)
tree7c98295562d91a05a284758c9ef22addfa81eee2 /src/HTML5/Serializer
parent0c430b52d4b9d6e58fa693afc9c4e53619c21230 (diff)
Moved serializing of DOMDocumentFragment to walking since we will only ever encounter this class once. It's a container like DOMDocument.
Diffstat (limited to 'src/HTML5/Serializer')
-rw-r--r--src/HTML5/Serializer/Traverser.php14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/HTML5/Serializer/Traverser.php b/src/HTML5/Serializer/Traverser.php
index 174528e..7f63e89 100644
--- a/src/HTML5/Serializer/Traverser.php
+++ b/src/HTML5/Serializer/Traverser.php
@@ -62,6 +62,13 @@ class Traverser {
if ($this->dom instanceof \DOMDocument) {
$this->rules->document($this->dom);
}
+ elseif ($this->dom instanceof \DOMDocumentFragment) {
+ // Document fragments are a special case. Only the children need to
+ // be serialized.
+ if ($this->dom->hasChildNodes()) {
+ $this->children($this->dom->childNodes);
+ }
+ }
// If NodeList, loop
elseif ($this->dom instanceof \DOMNodeList) {
// If this is a NodeList of DOMDocuments this will not work.
@@ -100,13 +107,6 @@ class Traverser {
case XML_COMMENT_NODE:
$this->rules->comment($node);
break;
- case XML_DOCUMENT_FRAG_NODE:
- // Document fragments are a special case. Only the children need to
- // be serialized.
- if ($node->hasChildNodes()) {
- $this->children($node->childNodes);
- }
- break;
// Currently we don't support embedding DTDs.
default:
print '<!-- Skipped -->';