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(ivy): match class and attribute value without case-sensitivity #32548

Closed

Conversation

@cexbrayat
Copy link
Contributor

commented Sep 8, 2019

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.io application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Prior to this commit, a directive with a selector selector=".Titledir" would not match an element like div class="titleDir" in Ivy whereas it would in VE. The same issue was present for selector="[title=Titledir] and title="titleDir".

What is the new behavior?

This fixes the Ivy behavior by changing the matching algorithm to use lowercased values.

Does this PR introduce a breaking change?

  • Yes
  • No

(well it can if someone was relying on Ivy behaving differently than VE, but I don't think it is the case).

Other information

Note that some render3 tests needed to be changed to reflect that the compiler generates lowercase selectors. These tests are in the process to be migrated to acceptance to use TestBed in another PR anyway.

Adds two acceptance tests to show a current difference in behavior between Ivy and VE.
A directive with a selector `.Titledir` matches an element with `class="titleDir"` in VE but not in Ivy.
Same thing for an attribute value.
@cexbrayat cexbrayat requested a review from angular/fw-core as a code owner Sep 8, 2019
@googlebot googlebot added the cla: yes label Sep 8, 2019
Prior to this commit, a directive with a selector `selector=".Titledir"` would not match an element like `div class="titleDir"` in Ivy whereas it would in VE. The same issue was present for `selector="[title=Titledir]` and `title="titleDir"`.  This fixes the Ivy behavior by changing the matching algorithm to use lowercased values.

Note that some `render3` tests needed to be changed to reflect that the compiler generates lowercase selectors. These tests are in the process to be migrated to `acceptance` to use `TestBed` in another PR anyway.
@cexbrayat cexbrayat force-pushed the cexbrayat:fix/case-insensitive-match branch from 758c99b to 952ad69 Sep 8, 2019
@ngbot ngbot bot modified the milestone: needsTriage Sep 9, 2019
Copy link
Member

left a comment

LGTM.
I'm a bit concerned that the packages/core/src/render3/node_selector_matcher.ts is quite complex and is becoming slightly more complex, but any improvements are a story for a separate PR.

@kara
kara approved these changes Sep 10, 2019
Copy link
Contributor

left a comment

LGTM

@kara

This comment has been minimized.

Copy link
Contributor

commented Sep 10, 2019

@matsko matsko closed this in 8a6e54a Sep 10, 2019
matsko added a commit that referenced this pull request Sep 10, 2019
…32548)

Prior to this commit, a directive with a selector `selector=".Titledir"` would not match an element like `div class="titleDir"` in Ivy whereas it would in VE. The same issue was present for `selector="[title=Titledir]` and `title="titleDir"`.  This fixes the Ivy behavior by changing the matching algorithm to use lowercased values.

Note that some `render3` tests needed to be changed to reflect that the compiler generates lowercase selectors. These tests are in the process to be migrated to `acceptance` to use `TestBed` in another PR anyway.

PR Close #32548
@cexbrayat cexbrayat referenced this pull request Sep 10, 2019
4 of 14 tasks complete
@cexbrayat cexbrayat deleted the cexbrayat:fix/case-insensitive-match branch Sep 10, 2019
@cexbrayat cexbrayat referenced this pull request Sep 10, 2019
2 of 14 tasks complete
arnehoek added a commit to arnehoek/angular that referenced this pull request Sep 26, 2019
Adds two acceptance tests to show a current difference in behavior between Ivy and VE.
A directive with a selector `.Titledir` matches an element with `class="titleDir"` in VE but not in Ivy.
Same thing for an attribute value.

PR Close angular#32548
arnehoek added a commit to arnehoek/angular that referenced this pull request Sep 26, 2019
…ngular#32548)

Prior to this commit, a directive with a selector `selector=".Titledir"` would not match an element like `div class="titleDir"` in Ivy whereas it would in VE. The same issue was present for `selector="[title=Titledir]` and `title="titleDir"`.  This fixes the Ivy behavior by changing the matching algorithm to use lowercased values.

Note that some `render3` tests needed to be changed to reflect that the compiler generates lowercase selectors. These tests are in the process to be migrated to `acceptance` to use `TestBed` in another PR anyway.

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

This comment has been minimized.

Copy link

commented Oct 11, 2019

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 Oct 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.