Skip to content

fix(common): remove assertNoComplexSizes from NgOptimizedImage#67116

Closed
apoorvdarshan wants to merge 1 commit intoangular:mainfrom
apoorvdarshan:fix/remove-assert-no-complex-sizes
Closed

fix(common): remove assertNoComplexSizes from NgOptimizedImage#67116
apoorvdarshan wants to merge 1 commit intoangular:mainfrom
apoorvdarshan:fix/remove-assert-no-complex-sizes

Conversation

@apoorvdarshan
Copy link

@apoorvdarshan apoorvdarshan commented Feb 18, 2026

Summary

  • Remove the assertNoComplexSizes assertion that throws NG02952 in dev mode when sizes contains pixel values (e.g. 370px)
  • Pixel values in sizes are valid HTML and work correctly in production, so the assertion blocks valid use cases like sizes="(max-width: 540px) 100vw, (max-width: 960px) 50vw, 370px"
  • Remove the corresponding tests for the removed assertion

Closes #59495

Test plan

  • Verify existing NgOptimizedImage tests pass (bazel test //packages/common/test:test)
  • Confirm sizes attributes with pixel values no longer throw NG02952 in dev mode

The assertNoComplexSizes assertion throws NG02952 in dev mode when
`sizes` contains pixel values (e.g. `370px`). However, pixel values
in `sizes` are valid HTML and work correctly in production. This
blocks valid use cases like
`sizes="(max-width: 540px) 100vw, (max-width: 960px) 50vw, 370px"`.

Closes angular#59495
@pullapprove pullapprove bot requested a review from AndrewKushnir February 18, 2026 10:24
@angular-robot angular-robot bot added the area: common Issues related to APIs in the @angular/common package label Feb 18, 2026
@JeanMeche
Copy link
Member

We don't want to remove that check entirely, #67070 looks more interesting for example.

@JeanMeche JeanMeche closed this Feb 18, 2026
@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 Mar 21, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area: common Issues related to APIs in the @angular/common package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove assertNoComplexSizes from NgOptimizedImage

2 participants