From 9412e17c31bf0f25310fcae9bde603a69e819fb0 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 17 Mar 2023 08:57:14 +0800 Subject: [PATCH] set xmlns attribute, instead of keeping --- build/generate-svg.js | 11 +++++++++-- public/img/svg/material-invert-colors.svg | 2 +- public/img/svg/material-palette.svg | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/build/generate-svg.js b/build/generate-svg.js index f304795bc019..dc82ed465a20 100755 --- a/build/generate-svg.js +++ b/build/generate-svg.js @@ -25,7 +25,7 @@ async function processFile(file, {prefix, fullName} = {}) { if (prefix === 'octicon') name = name.replace(/-[0-9]+$/, ''); // chop of '-16' on octicons } - // keep the `xmlns` attribute so that the files are displayble in standalone documents + // Set the `xmlns` attribute so that the files are displayable in standalone documents // The svg backend module will strip the attribute during startup for inline display const {data} = optimize(await readFile(file, 'utf8'), { plugins: [ @@ -33,7 +33,14 @@ async function processFile(file, {prefix, fullName} = {}) { {name: 'removeDimensions'}, {name: 'prefixIds', params: {prefix: () => name}}, {name: 'addClassesToSVGElement', params: {classNames: ['svg', name]}}, - {name: 'addAttributesToSVGElement', params: {attributes: [{'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}]}}, + { + name: 'addAttributesToSVGElement', params: { + attributes: [ + {'xmlns': 'http://www.w3.org/2000/svg'}, + {'width': '16'}, {'height': '16'}, {'aria-hidden': 'true'}, + ] + } + }, ], }); diff --git a/public/img/svg/material-invert-colors.svg b/public/img/svg/material-invert-colors.svg index 018a693a02da..576ec72a785b 100644 --- a/public/img/svg/material-invert-colors.svg +++ b/public/img/svg/material-invert-colors.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/public/img/svg/material-palette.svg b/public/img/svg/material-palette.svg index d257e65d3355..f719dadc5d02 100644 --- a/public/img/svg/material-palette.svg +++ b/public/img/svg/material-palette.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file