summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatt Farina <[email protected]>2016-03-15 06:51:29 -0400
committerMatt Farina <[email protected]>2016-03-15 06:51:29 -0400
commitbb79919ffc7df4914ff5a489cf2ad2ad0602ff88 (patch)
treebbae186b45a7d1e5c332b2bb84f5a9f6f4f041ca
parent7cb4945f591204bef9c226fd97e272436e1ecc0a (diff)
Fixes #96: Parser breaking xml:href on svgs that use the "use" element
-rw-r--r--src/HTML5/Serializer/OutputRules.php2
-rw-r--r--test/HTML5/Html5Test.php3
2 files changed, 4 insertions, 1 deletions
diff --git a/src/HTML5/Serializer/OutputRules.php b/src/HTML5/Serializer/OutputRules.php
index 774a349..c45045f 100644
--- a/src/HTML5/Serializer/OutputRules.php
+++ b/src/HTML5/Serializer/OutputRules.php
@@ -349,7 +349,7 @@ class OutputRules implements \Masterminds\HTML5\Serializer\RulesInterface
// the XML, XMLNS, or XLink NS's should use the canonical
// prefix. It seems that DOM does this for us already, but there
// may be exceptions.
- $name = $node->name;
+ $name = $node->nodeName;
// Special handling for attributes in SVG and MathML.
// Using if/elseif instead of switch because it's faster in PHP.
diff --git a/test/HTML5/Html5Test.php b/test/HTML5/Html5Test.php
index 23cb424..ce6bb0b 100644
--- a/test/HTML5/Html5Test.php
+++ b/test/HTML5/Html5Test.php
@@ -317,6 +317,9 @@ class Html5Test extends TestCase
public function testAttributes()
{
+ $res = $this->cycle('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>');
+ $this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
+
$res = $this->cycle('<div attr="val">FOO</div>');
$this->assertRegExp('|<div attr="val">FOO</div>|', $res);