Sitelet https://web.archive.org/web/20220321093845/https://github.com/angular/angular/pull/40259
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

@crisbeto crisbeto commented Dec 24, 2020

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 Dec 24, 2020
@pullapprove pullapprove bot requested review from ayazhafiz and JoostK Dec 24, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 24, 2020
@ngbot ngbot bot added this to the Backlog milestone Dec 24, 2020
Copy link
Member

@JoostK JoostK left a comment

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

@crisbeto crisbeto commented Dec 24, 2020

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 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 crisbeto force-pushed the 31503-svg-title-content-type branch from 5cb45e3 to 18fa418 Compare Dec 25, 2020
@crisbeto
Copy link
Member Author

@crisbeto crisbeto commented Dec 25, 2020

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 force-pushed the 31503-svg-title-content-type branch from 18fa418 to 693fbf1 Compare Dec 25, 2020
JoostK
JoostK approved these changes Jan 11, 2021
@crisbeto
Copy link
Member Author

@crisbeto crisbeto commented Jan 11, 2021

Merge assistance: needs a presubmit.

@atscott
Copy link
Contributor

@atscott atscott commented Jan 11, 2021

@atscott atscott removed the request for review from ayazhafiz Jan 11, 2021
atscott added a commit that referenced this issue 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

@angular-automatic-lock-bot angular-automatic-lock-bot bot commented Feb 11, 2021

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.
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

3 participants