From 3114f3a9bbdd3f62e3093d98c686fcd41f738ec5 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 29 Mar 2021 18:50:45 -0400 Subject: [PATCH] Fix most serializer test failures Three remain related to xmlns attributes --- lib/DOM/Element.php | 2 +- lib/DOM/Text.php | 6 +- lib/DOM/traits/EscapeString.php | 14 +-- lib/DOM/traits/Serialize.php | 2 +- tests/cases/TestSerializer.php | 135 ++++++++++++++++++++++++++++ tests/cases/TestTreeConstructor.php | 5 +- tests/cases/serializer/wpt01.dat | 45 ++++++---- tests/phpunit.dist.xml | 3 + 8 files changed, 180 insertions(+), 32 deletions(-) create mode 100644 tests/cases/TestSerializer.php diff --git a/lib/DOM/Element.php b/lib/DOM/Element.php index 4e3a0a0..160e551 100644 --- a/lib/DOM/Element.php +++ b/lib/DOM/Element.php @@ -323,7 +323,7 @@ class Element extends \DOMElement { # If the attribute is in some other namespace default: # The attribute’s serialized name is the attribute’s qualified name. - $name = $attr->name; + $name = $attr->nodeName; } $value = $this->escapeString($attr->value, true); diff --git a/lib/DOM/Text.php b/lib/DOM/Text.php index 761dc2f..5f29dd9 100644 --- a/lib/DOM/Text.php +++ b/lib/DOM/Text.php @@ -14,8 +14,10 @@ class Text extends \DOMText { # noframes, or plaintext element, or if the parent of current node is a noscript # element and scripting is enabled for the node, then append the value of # current node’s data IDL attribute literally. - // DEVIATION: No scripting. - + // DEVIATION: No scripting, so