Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(compiler): incorrectly inferring content type of SVG-specific title tag #40259

Closed

Conversation

crisbeto
Copy link
Member

The parser has a list of tag definitions that it uses when parsing the template. Each tag has a contentType which tells the parser what kind of content the tag should contain. The problem is that the browser has two separate title tags (HTMLTitleElement and SVGTitleElement) and each of them has to have a different contentType, otherwise the parser will throw an error further down the pipeline.

These changes update the tag definitions so that each tag name can have multiple content types associated with it and the correct one can be returned based on the element's prefix.

Fixes #31503.

@google-cla google-cla bot added the cla: yes label Dec 24, 2020
@crisbeto crisbeto marked this pull request as ready for review December 24, 2020 11:51
@pullapprove pullapprove bot added area: compiler Issues related to `ngc`, Angular's template compiler area: language-service Issues related to Angular's VS Code language service labels Dec 24, 2020
@ngbot ngbot bot modified the milestone: Backlog Dec 24, 2020
@crisbeto crisbeto 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 type: bug/fix and removed area: language-service Issues related to Angular's VS Code language service labels Dec 24, 2020
@pullapprove pullapprove bot added the area: language-service Issues related to Angular's VS Code language service label Dec 24, 2020
Copy link
Member

@JoostK JoostK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WDYT about adding some tests to packages/compiler/test/ml_parser/lexer_spec.ts, e.g. testing the simple case but also testing with child elements?

@crisbeto
Copy link
Member Author

Sure. By "testing with child elements", do you mean having a title with children or title being the child of something specific?

@JoostK
Copy link
Member

JoostK commented Dec 24, 2020

A title with children. I believe that's allowed (from what I read on MDN), and PARSABLE_DATA should indeed accept it.

@crisbeto
Copy link
Member Author

The extra unit tests have been added.

…le tag

The parser has a list of tag definitions that it uses when parsing the template. Each tag has a
`contentType` which tells the parser what kind of content the tag should contain. The problem is
that the browser has two separate `title` tags (`HTMLTitleElement` and `SVGTitleElement`) and each
of them has to have a different `contentType`, otherwise the parser will throw an error further down
the pipeline.

These changes update the tag definitions so that each tag name can have multiple content types
associated with it and the correct one can be returned based on the element's prefix.

Fixes angular#31503.
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note action: presubmit The PR is in need of a google3 presubmit and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Jan 11, 2021
@crisbeto
Copy link
Member Author

Merge assistance: needs a presubmit.

@atscott
Copy link
Contributor

atscott commented Jan 11, 2021

presubmit

@crisbeto crisbeto removed the merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note label Jan 11, 2021
@atscott atscott removed the action: presubmit The PR is in need of a google3 presubmit label Jan 11, 2021
@atscott atscott removed the request for review from ayazhafiz January 11, 2021 20:56
@atscott atscott closed this in 66c27ff Jan 11, 2021
atscott pushed a commit that referenced this pull request Jan 11, 2021
…le tag (#40259)

The parser has a list of tag definitions that it uses when parsing the template. Each tag has a
`contentType` which tells the parser what kind of content the tag should contain. The problem is
that the browser has two separate `title` tags (`HTMLTitleElement` and `SVGTitleElement`) and each
of them has to have a different `contentType`, otherwise the parser will throw an error further down
the pipeline.

These changes update the tag definitions so that each tag name can have multiple content types
associated with it and the correct one can be returned based on the element's prefix.

Fixes #31503.

PR Close #40259
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 11, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker area: compiler Issues related to `ngc`, Angular's template compiler area: language-service Issues related to Angular's VS Code language service cla: yes target: patch This PR is targeted for the next patch release type: bug/fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EOF error when using svg:title tag in component template
3 participants