Skip to content

Commit e39b7c0

Browse files
committed
Parse styles contained within defs
fixes #98
1 parent c6acd17 commit e39b7c0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/Svg/Document.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ function _tagEnd($parser, $name)
401401
break;
402402
}
403403

404-
if (!$this->inDefs && $tag) {
404+
if ((!$this->inDefs && $tag) || $tag instanceof StyleTag) {
405405
$tag->handleEnd();
406406
}
407407
}

src/Svg/Tag/AbstractTag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,15 @@ public function handle($attributes)
5959
{
6060
$this->attributes = $attributes;
6161

62-
if (!$this->getDocument()->inDefs) {
62+
if (!$this->getDocument()->inDefs || $this instanceof StyleTag) {
6363
$this->before($attributes);
6464
$this->start($attributes);
6565
}
6666
}
6767

6868
public function handleEnd()
6969
{
70-
if (!$this->getDocument()->inDefs) {
70+
if (!$this->getDocument()->inDefs || $this instanceof StyleTag) {
7171
$this->end();
7272
$this->after();
7373
}

0 commit comments

Comments
 (0)