Skip to content

Commit 498534b

Browse files
crisbetojelbourn
authored andcommitted
fix(icon): namespace error when registering an icon on the server (#10175)
Fixes the `MatIconRegistry` throwing a namespace error on the server due to the `xmlns` attribute. These changes remove the attribute, because it's optional under HTML5. Fixes #10170.
1 parent 34e96f5 commit 498534b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/lib/icon/icon-registry.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -459,9 +459,6 @@ export class MatIconRegistry {
459459
* Sets the default attributes for an SVG element to be used as an icon.
460460
*/
461461
private _setSvgAttributes(svg: SVGElement): SVGElement {
462-
if (!svg.getAttribute('xmlns')) {
463-
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
464-
}
465462
svg.setAttribute('fit', '');
466463
svg.setAttribute('height', '100%');
467464
svg.setAttribute('width', '100%');

src/universal-app/prerender.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, {
1515

1616
result
1717
.then(content => {
18-
writeFileSync(join(__dirname, 'index-prerendered.html'), content, 'utf-8');
18+
const filename = join(__dirname, 'index-prerendered.html');
19+
20+
console.log(`Outputting result to ${filename}`);
21+
writeFileSync(filename, content, 'utf-8');
1922
log('Prerender done.');
2023
})
2124
// If rendering the module factory fails, exit the process with an error code because otherwise

0 commit comments

Comments
 (0)