Skip to content

Commit 9399dff

Browse files
authored
Merge pull request #5 from Paneon/develop
Release 0.3.1
2 parents c3a1e36 + 022eb87 commit 9399dff

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

src/Compiler.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,21 @@ public function convert(): string
7777

7878
public function convertNode(DOMNode $node): DOMNode
7979
{
80-
if ($node->nodeType === XML_TEXT_NODE) {
81-
return $node;
82-
}
83-
84-
if ($node->nodeType === XML_ELEMENT_NODE) {
85-
//echo "\nElement node found";
86-
/** @var DOMElement $node */
87-
$this->replaceShowWithIf($node);
88-
$this->handleIf($node);
89-
} elseif ($node->nodeType === XML_HTML_DOCUMENT_NODE) {
90-
$this->logger->warning("Document node found.");
80+
switch($node->nodeType) {
81+
case XML_TEXT_NODE:
82+
$this->logger->debug('Text node found', ['name' => $node->nodeName]);
83+
// fall through to next case, because we don't need to handle either of these node-types
84+
case XML_COMMENT_NODE:
85+
$this->logger->debug('Comment node found', ['name' => $node->nodeName]);
86+
return $node;
87+
case XML_ELEMENT_NODE:
88+
/** @var DOMElement $node */
89+
$this->replaceShowWithIf($node);
90+
$this->handleIf($node);
91+
break;
92+
case XML_HTML_DOCUMENT_NODE:
93+
$this->logger->warning("Document node found.");
94+
break;
9195
}
9296

9397
$this->stripEventHandlers($node);

0 commit comments

Comments
 (0)