mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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.
This commit is contained in:
committed by
Jeremy Elbourn
parent
34e96f5d9d
commit
498534bbaa
@@ -459,9 +459,6 @@ export class MatIconRegistry {
|
||||
* Sets the default attributes for an SVG element to be used as an icon.
|
||||
*/
|
||||
private _setSvgAttributes(svg: SVGElement): SVGElement {
|
||||
if (!svg.getAttribute('xmlns')) {
|
||||
svg.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
||||
}
|
||||
svg.setAttribute('fit', '');
|
||||
svg.setAttribute('height', '100%');
|
||||
svg.setAttribute('width', '100%');
|
||||
|
||||
@@ -15,7 +15,10 @@ const result = renderModuleFactory(KitchenSinkServerModuleNgFactory, {
|
||||
|
||||
result
|
||||
.then(content => {
|
||||
writeFileSync(join(__dirname, 'index-prerendered.html'), content, 'utf-8');
|
||||
const filename = join(__dirname, 'index-prerendered.html');
|
||||
|
||||
console.log(`Outputting result to ${filename}`);
|
||||
writeFileSync(filename, content, 'utf-8');
|
||||
log('Prerender done.');
|
||||
})
|
||||
// If rendering the module factory fails, exit the process with an error code because otherwise
|
||||
|
||||
Reference in New Issue
Block a user