Skip to content

Commit 76876c6

Browse files
committed
Support non-namespaced href attribute
The SVG 2 specification deprecated usage of the xlink namespace when specifying resource references (href attribute) in supported SVG elements. https://svgwg.org/svg2-draft/linking.html#XLinkRefAttrs
1 parent 058524e commit 76876c6

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Svg/Tag/Image.php

+4
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ public function start($attributes)
5252
$this->href = $attributes['xlink:href'];
5353
}
5454

55+
if (isset($attributes['href'])) {
56+
$this->href = $attributes['href'];
57+
}
58+
5559
$this->document->getSurface()->transform(1, 0, 0, -1, 0, $height);
5660

5761
$this->document->getSurface()->drawImage($this->href, $this->x, $this->y, $this->width, $this->height);

src/Svg/Tag/UseTag.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ protected function before($attributes)
3838

3939
$document = $this->getDocument();
4040

41-
$link = $attributes["xlink:href"];
41+
$link = $attributes["href"] ?? $attributes["xlink:href"];
4242
$this->reference = $document->getDef($link);
4343

4444
if ($this->reference) {

0 commit comments

Comments
 (0)