Skip to content

Refactor SVG inlining from md-icon into cdk-svg #5188

Open
@jelbourn

Description

@jelbourn

The SVG inlining features of md-icon are more generally useful than for just displaying icons. We should refactor the code such that:

  • The SVG portions of MdIconRegistry are moved to IconRegistry in the cdk, with MdIconRegistry then extending IconRegistry
  • The SVG inlining code in md-icon is moved into cdk-svg with md-icon then consuming cdk-svg.

This will enable us to add additional APIs to cdk-svg around customizing viewBox and preserveAspectRatio (see https://css-tricks.com/scale-svg)

Notes:

  • Part of this should be moving SVG parsing (i.e. string -> SVGElement) into its own utility that can be mocked. This will be useful when ensuring that parsing only happens when expected (since it can have performance impacts if overdone).

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: material/iconrefactoringThis issue is related to a refactoring

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions