Skip to content

fix(compiler): prevent namespaced SVG <style> elements from being stripped#68979

Merged
pkozlowski-opensource merged 1 commit into
angular:mainfrom
alan-agius4:svg-style-fix-main
May 28, 2026
Merged

fix(compiler): prevent namespaced SVG <style> elements from being stripped#68979
pkozlowski-opensource merged 1 commit into
angular:mainfrom
alan-agius4:svg-style-fix-main

Conversation

@alan-agius4
Copy link
Copy Markdown
Contributor

Updates the template preparser to exclude namespaced SVG style tags (':svg:style') from the style elements set.

Previously, ':svg:style' elements were incorrectly classified as PreparsedElementType.STYLE, which caused them to be completely stripped from the final template DOM tree during the Render3 template transform and pushed into standard component stylesheets. By limiting the style element parsing to standard 'style' tags, namespaced SVG style tags remain safely in the template AST as normal DOM elements, preserving local SVG styling.

Closes #68977

…ipped

Updates the template preparser to exclude namespaced SVG style tags (':svg:style') from the style elements set.

Previously, ':svg:style' elements were incorrectly classified as PreparsedElementType.STYLE, which caused them to be completely stripped from the final template DOM tree during the Render3 template transform and pushed into standard component stylesheets. By limiting the style element parsing to standard 'style' tags, namespaced SVG style tags remain safely in the template AST as normal DOM elements, preserving local SVG styling.

Closes angular#68977
@pullapprove pullapprove Bot requested a review from kirjs May 28, 2026 08:41
@angular-robot angular-robot Bot added the area: compiler Issues related to `ngc`, Angular's template compiler label May 28, 2026
@ngbot ngbot Bot added this to the Backlog milestone May 28, 2026
@alan-agius4 alan-agius4 removed the request for review from kirjs May 28, 2026 08:42
@pullapprove pullapprove Bot requested a review from kirjs May 28, 2026 08:42
@alan-agius4 alan-agius4 requested review from JeanMeche and removed request for kirjs May 28, 2026 08:43
@alan-agius4 alan-agius4 added action: review The PR is still awaiting reviews from at least one requested reviewer target: patch This PR is targeted for the next patch release labels May 28, 2026
@alan-agius4 alan-agius4 added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels May 28, 2026
@pkozlowski-opensource pkozlowski-opensource merged commit ec138c3 into angular:main May 28, 2026
29 checks passed
@pkozlowski-opensource
Copy link
Copy Markdown
Member

This PR was merged into the repository. The changes were merged into the following branches:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Defs tags inside svg are stripped after updating to Angular v20.3.22

3 participants