Skip to content

Commit

Permalink
Parse styles contained within defs
Browse files Browse the repository at this point in the history
fixes #98
  • Loading branch information
bsweeney committed Jan 8, 2024
1 parent 492fd3a commit 83ff2b6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/Svg/Document.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ function _tagEnd($parser, $name)
break;
}

if (!$this->inDefs && $tag) {
if ((!$this->inDefs && $tag) || $tag instanceof StyleTag) {
$tag->handleEnd();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Svg/Tag/AbstractTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,15 @@ public function handle($attributes)
{
$this->attributes = $attributes;

if (!$this->getDocument()->inDefs) {
if (!$this->getDocument()->inDefs || $this instanceof StyleTag) {
$this->before($attributes);
$this->start($attributes);
}
}

public function handleEnd()
{
if (!$this->getDocument()->inDefs) {
if (!$this->getDocument()->inDefs || $this instanceof StyleTag) {
$this->end();
$this->after();
}
Expand Down

0 comments on commit 83ff2b6

Please sign in to comment.