Skip to content

Commit 9197e05

Browse files
authored
Merge pull request #982 from ecomfe/fix-svg-encode
fix(svg): fix unexpected encoding for `style` tag
2 parents 04e2693 + 7c71903 commit 9197e05

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/svg/core.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,9 @@ export function vNodeToString(el: SVGVNode, opts?: {
7070
opts = opts || {};
7171
const S = opts.newline ? '\n' : '';
7272
function convertElToString(el: SVGVNode): string {
73-
const {children, tag, attrs} = el;
73+
const {children, tag, attrs, text} = el;
7474
return createElementOpen(tag, attrs)
75-
+ encodeHTML(el.text)
75+
+ (tag !== 'style' ? encodeHTML(text) : text || '')
7676
+ (children ? `${S}${map(children, child => convertElToString(child)).join(S)}${S}` : '')
7777
+ createElementClose(tag);
7878
}

0 commit comments

Comments
 (0)