Skip to content

v1.7.x with typescript 2.6.x css escape regression #9567

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

Closed
kondi opened this issue Feb 8, 2018 · 7 comments
Closed

v1.7.x with typescript 2.6.x css escape regression #9567

kondi opened this issue Feb 8, 2018 · 7 comments
Labels

Comments

@kondi
Copy link

kondi commented Feb 8, 2018

Versions

Angular CLI: 1.7.0-rc.0
Node: 7.4.0
OS: win32 x64
Angular: 5.2.4
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.0-rc.0
@angular-devkit/build-optimizer: 0.3.1
@angular-devkit/core: 0.3.1
@angular-devkit/schematics: 0.3.1
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.0-rc.0
@schematics/angular: 0.3.1
@schematics/package-update: 0.3.1
typescript: 2.6.1
webpack: 3.10.0

Repro steps

h1::before {
    content: 'A: \0041';
}
  • ng serve --prod => "A: A Welcome to app!" (works well)
  • Upgrade typescript to 2.6.1 (kondi/clicssbug@036e448)
  • ng serve --prod => "A: x00041 Welcome to app!" (buggy build)

Observed behavior

The prod build changes the escaping in the string literal of CSS rule to invalid \x00041:

h1[_ngcontent-c0]::before {
    content: 'A: \x00041';
}

Desired behavior

It should not change the represented value of the string literal.

Mention any other details that might be useful (optional)

  • Not prod build => OK
  • If cli downgraded to 1.6.x => OK
  • If typescript downgraded to 2.5.x => OK
  • If scss is used => Not OK
  • Same rule inside the global styles.css => OK

The syntax I used in the CSS literal is quite common if you use font icons.

@clydin
Copy link
Member

clydin commented Feb 8, 2018

After some investigation, this appears to be a TypeScript issue. This PR changed the string escaping code: microsoft/TypeScript#18026

@kondi
Copy link
Author

kondi commented Feb 8, 2018

Thank you for the investigation!
Do you have an idea why this is not a problem when I use the older cli with the same typescript version?

@clydin
Copy link
Member

clydin commented Feb 9, 2018

1.6.x and earlier used a different stylesheet optimization pipeline which coincidentally collapsed escaped values to a short form if possible (i.e., \0041 --> A). This essentially hid the underlying issue.

@filipesilva filipesilva added type: bug/fix freq1: low Only reported by a handful of users who observe it rarely severity3: broken labels Feb 13, 2018
@mcherb
Copy link

mcherb commented Feb 16, 2018

i get the same problem with 1.7.0 (which is released today)

@kondi
Copy link
Author

kondi commented Apr 17, 2018

I can't test now, but this might have been fixed by angular/angular#22776.

@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@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 Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

6 participants