Skip to content

fix(core): remove obsolete check for [class] and [className] presence - #41254

Closed
AndrewKushnir wants to merge 3 commits into
angular:masterfrom
AndrewKushnir:classes-exception
Closed

AndrewKushnir wants to merge 3 commits into
angular:masterfrom
AndrewKushnir:classes-exception

Conversation

@AndrewKushnir

Copy link
Copy Markdown
Contributor

Previously, presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in 6f203c9). Later, the situation was improved to actually allow both bindings to co-exist (see a153b61), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound class attributes are present on an element, for ex.:

<div class="{{ one }}" [class]="'two'"></div>

In the current situation the error is actually misleading (as it refers to [className]).

This commit removes the mentioned compiler check as obsolete and makes the class and style attribute processing logically the same (the last occurrence is used to compute the value).

PR Type

What kind of change does this PR introduce?

  • Bugfix

Does this PR introduce a breaking change?

  • Yes
  • No

@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release core: styling bindings labels Mar 18, 2021
@AndrewKushnir
AndrewKushnir requested a review from mhevery March 18, 2021 00:40
@ngbot ngbot Bot modified the milestone: Backlog Mar 18, 2021
@google-cla google-cla Bot added the cla: yes label Mar 18, 2021
Previously presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in angular@6f203c9). Later, the situation was improved to actually allow both bindings to co-exist (see angular@a153b61), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound `class` attributes are present on an element, for ex.:

```
<div class="{{ one }}" [class]="'two'"></div>
```

In the current situation the error is acually misleading (as it refers to `[className]`).

This commit removes the mentioned compiler check as obsolete and makes the `class` and `style` attribute processing logically the same (the last occurrence is used to compute the value).
@AndrewKushnir
AndrewKushnir marked this pull request as ready for review March 19, 2021 00:44
@AndrewKushnir AndrewKushnir added the action: presubmit The PR is in need of a google3 presubmit label Mar 19, 2021
@AndrewKushnir

Copy link
Copy Markdown
Contributor Author

Presubmit.

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: presubmit The PR is in need of a google3 presubmit action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 19, 2021
mhevery pushed a commit that referenced this pull request Mar 19, 2021
…#41254)

Previously presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in 6f203c9). Later, the situation was improved to actually allow both bindings to co-exist (see a153b61), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound `class` attributes are present on an element, for ex.:

```
<div class="{{ one }}" [class]="'two'"></div>
```

In the current situation the error is acually misleading (as it refers to `[className]`).

This commit removes the mentioned compiler check as obsolete and makes the `class` and `style` attribute processing logically the same (the last occurrence is used to compute the value).

PR Close #41254
@mhevery mhevery closed this in 3a55698 Mar 19, 2021
TeriGlover pushed a commit to TeriGlover/angular that referenced this pull request Apr 5, 2021
…angular#41254)

Previously presence of both [class] and [className] bindings on an element was treated as compiler error (implemented in angular@6f203c9). Later, the situation was improved to actually allow both bindings to co-exist (see angular@a153b61), however the compiler check was not removed completely. The only situation where the error is thrown at this moment is when static (but with interpolation) and bound `class` attributes are present on an element, for ex.:

```
<div class="{{ one }}" [class]="'two'"></div>
```

In the current situation the error is acually misleading (as it refers to `[className]`).

This commit removes the mentioned compiler check as obsolete and makes the `class` and `style` attribute processing logically the same (the last occurrence is used to compute the value).

PR Close angular#41254
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Apr 19, 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: core Issues related to the framework runtime cla: yes core: styling bindings target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants