Skip to content

Commit 932ae3a

Browse files
authoredAug 19, 2021
fix(svg): remove xmlns (#4839)
xml namespace is not required for svg elements (and has never been https://stackoverflow.com/a/18468348/3185307), only for svg documents. This saves a probably insignificant amount of bundlesize
1 parent 413c2db commit 932ae3a

File tree

6 files changed

+17
-18
lines changed

6 files changed

+17
-18
lines changed
 

‎src/widgets/rating-menu/rating-menu.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ const renderer =
159159
templateProps={renderState.templateProps!}
160160
toggleRefinement={refine}
161161
>
162-
<svg xmlns="http://www.w3.org/2000/svg" style="display:none;">
162+
<svg style="display:none;">
163163
<symbol
164164
id={suit({ descendantName: 'starSymbol' })}
165165
viewBox="0 0 24 24"

‎src/widgets/refinement-list/__tests__/__snapshots__/refinement-list-test.ts.snap

+3-3
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ Object {
5151
"searchBoxTemplateProps": Object {
5252
"templates": Object {
5353
"loadingIndicator": "
54-
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" xmlns=\\"http://www.w3.org/2000/svg\\" stroke=\\"#444\\">
54+
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" stroke=\\"#444\\">
5555
<g fill=\\"none\\" fillRule=\\"evenodd\\">
5656
<g transform=\\"translate(1 1)\\" strokeWidth=\\"2\\">
5757
<circle strokeOpacity=\\".5\\" cx=\\"18\\" cy=\\"18\\" r=\\"18\\" />
@@ -70,12 +70,12 @@ Object {
7070
</svg>
7171
",
7272
"reset": "
73-
<svg class=\\"{{cssClasses.resetIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
73+
<svg class=\\"{{cssClasses.resetIcon}}\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
7474
<path d=\\"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\\"></path>
7575
</svg>
7676
",
7777
"submit": "
78-
<svg class=\\"{{cssClasses.submitIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
78+
<svg class=\\"{{cssClasses.submitIcon}}\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
7979
<path d=\\"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\\"></path>
8080
</svg>
8181
",

‎src/widgets/search-box/__tests__/__snapshots__/search-box-test.ts.snap

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Object {
2828
"showSubmit": true,
2929
"templates": Object {
3030
"loadingIndicator": "
31-
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" xmlns=\\"http://www.w3.org/2000/svg\\" stroke=\\"#444\\">
31+
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" stroke=\\"#444\\">
3232
<g fill=\\"none\\" fillRule=\\"evenodd\\">
3333
<g transform=\\"translate(1 1)\\" strokeWidth=\\"2\\">
3434
<circle strokeOpacity=\\".5\\" cx=\\"18\\" cy=\\"18\\" r=\\"18\\" />
@@ -47,12 +47,12 @@ Object {
4747
</svg>
4848
",
4949
"reset": "
50-
<svg class=\\"{{cssClasses.resetIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
50+
<svg class=\\"{{cssClasses.resetIcon}}\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
5151
<path d=\\"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\\"></path>
5252
</svg>
5353
",
5454
"submit": "
55-
<svg class=\\"{{cssClasses.submitIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
55+
<svg class=\\"{{cssClasses.submitIcon}}\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
5656
<path d=\\"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\\"></path>
5757
</svg>
5858
",
@@ -88,7 +88,7 @@ Object {
8888
"showSubmit": true,
8989
"templates": Object {
9090
"loadingIndicator": "
91-
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" xmlns=\\"http://www.w3.org/2000/svg\\" stroke=\\"#444\\">
91+
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" stroke=\\"#444\\">
9292
<g fill=\\"none\\" fillRule=\\"evenodd\\">
9393
<g transform=\\"translate(1 1)\\" strokeWidth=\\"2\\">
9494
<circle strokeOpacity=\\".5\\" cx=\\"18\\" cy=\\"18\\" r=\\"18\\" />
@@ -107,12 +107,12 @@ Object {
107107
</svg>
108108
",
109109
"reset": "
110-
<svg class=\\"{{cssClasses.resetIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
110+
<svg class=\\"{{cssClasses.resetIcon}}\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
111111
<path d=\\"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\\"></path>
112112
</svg>
113113
",
114114
"submit": "
115-
<svg class=\\"{{cssClasses.submitIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
115+
<svg class=\\"{{cssClasses.submitIcon}}\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
116116
<path d=\\"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\\"></path>
117117
</svg>
118118
",
@@ -148,7 +148,7 @@ Object {
148148
"showSubmit": true,
149149
"templates": Object {
150150
"loadingIndicator": "
151-
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" xmlns=\\"http://www.w3.org/2000/svg\\" stroke=\\"#444\\">
151+
<svg class=\\"{{cssClasses.loadingIcon}}\\" width=\\"16\\" height=\\"16\\" viewBox=\\"0 0 38 38\\" stroke=\\"#444\\">
152152
<g fill=\\"none\\" fillRule=\\"evenodd\\">
153153
<g transform=\\"translate(1 1)\\" strokeWidth=\\"2\\">
154154
<circle strokeOpacity=\\".5\\" cx=\\"18\\" cy=\\"18\\" r=\\"18\\" />
@@ -167,12 +167,12 @@ Object {
167167
</svg>
168168
",
169169
"reset": "
170-
<svg class=\\"{{cssClasses.resetIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
170+
<svg class=\\"{{cssClasses.resetIcon}}\\" viewBox=\\"0 0 20 20\\" width=\\"10\\" height=\\"10\\">
171171
<path d=\\"M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z\\"></path>
172172
</svg>
173173
",
174174
"submit": "
175-
<svg class=\\"{{cssClasses.submitIcon}}\\" xmlns=\\"http://www.w3.org/2000/svg\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
175+
<svg class=\\"{{cssClasses.submitIcon}}\\" width=\\"10\\" height=\\"10\\" viewBox=\\"0 0 40 40\\">
176176
<path d=\\"M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z\\"></path>
177177
</svg>
178178
",

‎src/widgets/search-box/defaultTemplates.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@ import type { SearchBoxComponentTemplates } from '../../components/SearchBox/Sea
22

33
const defaultTemplate: SearchBoxComponentTemplates = {
44
reset: `
5-
<svg class="{{cssClasses.resetIcon}}" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" width="10" height="10">
5+
<svg class="{{cssClasses.resetIcon}}" viewBox="0 0 20 20" width="10" height="10">
66
<path d="M8.114 10L.944 2.83 0 1.885 1.886 0l.943.943L10 8.113l7.17-7.17.944-.943L20 1.886l-.943.943-7.17 7.17 7.17 7.17.943.944L18.114 20l-.943-.943-7.17-7.17-7.17 7.17-.944.943L0 18.114l.943-.943L8.113 10z"></path>
77
</svg>
88
`,
99
submit: `
10-
<svg class="{{cssClasses.submitIcon}}" xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 40 40">
10+
<svg class="{{cssClasses.submitIcon}}" width="10" height="10" viewBox="0 0 40 40">
1111
<path d="M26.804 29.01c-2.832 2.34-6.465 3.746-10.426 3.746C7.333 32.756 0 25.424 0 16.378 0 7.333 7.333 0 16.378 0c9.046 0 16.378 7.333 16.378 16.378 0 3.96-1.406 7.594-3.746 10.426l10.534 10.534c.607.607.61 1.59-.004 2.202-.61.61-1.597.61-2.202.004L26.804 29.01zm-10.426.627c7.323 0 13.26-5.936 13.26-13.26 0-7.32-5.937-13.257-13.26-13.257C9.056 3.12 3.12 9.056 3.12 16.378c0 7.323 5.936 13.26 13.258 13.26z"></path>
1212
</svg>
1313
`,
1414
loadingIndicator: `
15-
<svg class="{{cssClasses.loadingIcon}}" width="16" height="16" viewBox="0 0 38 38" xmlns="http://www.w3.org/2000/svg" stroke="#444">
15+
<svg class="{{cssClasses.loadingIcon}}" width="16" height="16" viewBox="0 0 38 38" stroke="#444">
1616
<g fill="none" fillRule="evenodd">
1717
<g transform="translate(1 1)" strokeWidth="2">
1818
<circle strokeOpacity=".5" cx="18" cy="18" r="18" />

‎src/widgets/voice-search/defaultTemplates.ts

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ const getButtonInnerElement = (
2424
const defaultTemplates: VoiceSearchComponentTemplates = {
2525
buttonText({ status, errorCode, isListening }) {
2626
return `<svg
27-
xmlns="http://www.w3.org/2000/svg"
2827
width="16"
2928
height="16"
3029
viewBox="0 0 24 24"

‎stories/query-rule-custom-data.stories.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ storiesOf('Metadata/QueryRuleCustomData', module)
109109
{
110110
title: 'Kill Bill',
111111
banner:
112-
'http://static.bobatv.net/IMovie/mv_2352/poster_2352.jpg',
112+
'https://static.bobatv.net/IMovie/mv_2352/poster_2352.jpg',
113113
link: 'https://www.netflix.com/title/60031236',
114114
},
115115
];

0 commit comments

Comments
 (0)
Please sign in to comment.