Skip to content

Commit bb79919

Browse files
committed
Fixes #96: Parser breaking xml:href on svgs that use the "use" element
1 parent 7cb4945 commit bb79919

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/HTML5/Serializer/OutputRules.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ protected function attrs($ele)
349349
// the XML, XMLNS, or XLink NS's should use the canonical
350350
// prefix. It seems that DOM does this for us already, but there
351351
// may be exceptions.
352-
$name = $node->name;
352+
$name = $node->nodeName;
353353

354354
// Special handling for attributes in SVG and MathML.
355355
// Using if/elseif instead of switch because it's faster in PHP.

test/HTML5/Html5Test.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ public function testElements()
317317

318318
public function testAttributes()
319319
{
320+
$res = $this->cycle('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>');
321+
$this->assertContains('<use xlink:href="#svg-track" xmlns:xlink="http://www.w3.org/1999/xlink"></use>', $res);
322+
320323
$res = $this->cycle('<div attr="val">FOO</div>');
321324
$this->assertRegExp('|<div attr="val">FOO</div>|', $res);
322325

0 commit comments

Comments
 (0)