Skip to content

Commit

Permalink
Escape brackets (twbs#29857)
Browse files Browse the repository at this point in the history
Co-authored-by: XhmikosR <xhmikosr@gmail.com>
  • Loading branch information
2 people authored and olsza committed Oct 3, 2020
1 parent 6502f73 commit 774614b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 6 additions & 1 deletion scss/_functions.scss
Expand Up @@ -75,7 +75,12 @@
@function escape-svg($string) {
@if str-index($string, "data:image/svg+xml") {
@each $char, $encoded in $escaped-characters {
$string: str-replace($string, $char, $encoded);
// Do not escape the url brackets
@if str-index($string, "url(") == 1 {
$string: url("#{str-replace(str-slice($string, 6, -3), $char, $encoded)}");
} @else {
$string: str-replace($string, $char, $encoded);
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions scss/_variables.scss
Expand Up @@ -208,6 +208,8 @@ $escaped-characters: (
("<","%3c"),
(">","%3e"),
("#","%23"),
("(","%28"),
(")","%29"),
) !default;

// Options
Expand Down

0 comments on commit 774614b

Please sign in to comment.