Skip to content

Commit

Permalink
Merge pull request #982 from ecomfe/fix-svg-encode
Browse files Browse the repository at this point in the history
fix(svg): fix unexpected encoding for `style` tag
  • Loading branch information
plainheart committed Dec 7, 2022
2 parents 04e2693 + 7c71903 commit 9197e05
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/svg/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,9 @@ export function vNodeToString(el: SVGVNode, opts?: {
opts = opts || {};
const S = opts.newline ? '\n' : '';
function convertElToString(el: SVGVNode): string {
const {children, tag, attrs} = el;
const {children, tag, attrs, text} = el;
return createElementOpen(tag, attrs)
+ encodeHTML(el.text)
+ (tag !== 'style' ? encodeHTML(text) : text || '')
+ (children ? `${S}${map(children, child => convertElToString(child)).join(S)}${S}` : '')
+ createElementClose(tag);
}
Expand Down

0 comments on commit 9197e05

Please sign in to comment.