diff options
Diffstat (limited to 'src/HTML5/Serializer')
-rw-r--r-- | src/HTML5/Serializer/Traverser.php | 30 |
1 files changed, 1 insertions, 29 deletions
diff --git a/src/HTML5/Serializer/Traverser.php b/src/HTML5/Serializer/Traverser.php index be485f4..788292d 100644 --- a/src/HTML5/Serializer/Traverser.php +++ b/src/HTML5/Serializer/Traverser.php @@ -14,17 +14,6 @@ use \HTML5\Elements; */ class Traverser { - // TODO: Refactor this into an element mask. - static $literal_elements = array( - 'style' => 1, - 'script' => 1, - 'xmp' => 1, - 'iframe' => 1, - 'noembed' => 1, - 'noframes' => 1, - 'plaintext' => 1, - ); - /** Namespaces that should be treated as "local" to HTML5. */ static $local_ns = array( 'http://www.w3.org/1999/xhtml' => 'html', @@ -173,7 +162,7 @@ class Traverser { * The text node to write. */ protected function text($ele) { - if ($this->isLiteral($ele)) { + if ($ele->parentNode && Elements::isA($ele->parentNode->tagName, Elements::TEXT_RAW | Elements::TEXT_RCDATA)) { $this->wr($ele->wholeText); return; } @@ -291,23 +280,6 @@ class Traverser { } /** - * Is the element literal? - * - * @param mixed $element - * An element implementing DOMNode. - * - * @return boolean - * True if literal and false otherise. - */ - protected function isLiteral($element) { - if (!$element->parentNode) { - return FALSE; - } - return isset(self::$literal_elements[$element->parentNode->tagName]); - - } - - /** * Is an element local? * * @param mixed $ele |