summaryrefslogtreecommitdiff
path: root/src/HTML5/Serializer/Traverser.php
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2013-05-06 20:41:28 -0400
committerMatt Farina <[email protected]>2013-05-06 20:41:28 -0400
commita98febd74b7c6e7d18b11ca8a75b647f56fcf2c6 (patch)
tree3c22dd14c39409bd414cdbdbc0809ca3d9d0a2d4 /src/HTML5/Serializer/Traverser.php
parentcb6da5768688773ed56c0b05f27c8529b6dc34c8 (diff)
Updated the traverser text method and added a test.
Diffstat (limited to 'src/HTML5/Serializer/Traverser.php')
-rw-r--r--src/HTML5/Serializer/Traverser.php30
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