Skip to content

Commit

Permalink
Update web_src/js/svg.js, fix lint
Browse files Browse the repository at this point in the history
Co-authored-by: silverwind <[email protected]>
  • Loading branch information
wxiaoguang and silverwind committed Mar 22, 2023
1 parent a000a61 commit 5677a81
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions web_src/js/svg.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ export function svg(name, size = 16, className = '') {

const document = parser.parseFromString(svgs[name], 'image/svg+xml');
const svgNode = document.firstChild;
if (size !== 16) svgNode.setAttribute('width', String(size));
if (size !== 16) svgNode.setAttribute('height', String(size));
if (size !== 16) {
svgNode.setAttribute('width', String(size));
svgNode.setAttribute('height', String(size));
}
if (className) svgNode.classList.add(...className.split(/\s+/).filter(Boolean));
return serializer.serializeToString(svgNode);
}
Expand Down

0 comments on commit 5677a81

Please sign in to comment.