Skip to content

Commit

Permalink
fix(icon): namespace error when registering an icon on the server
Browse files Browse the repository at this point in the history
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 angular#10170.
  • Loading branch information
crisbeto committed Feb 27, 2018
1 parent d078e5e commit 63febc0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 0 additions & 3 deletions src/lib/icon/icon-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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%');
Expand Down
5 changes: 4 additions & 1 deletion src/universal-app/prerender.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 63febc0

Please sign in to comment.