Skip to content

fix(icon): reverse for loop when removing child nodes from mat-icon #12073

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
wants to merge 45 commits into from
Closed

fix(icon): reverse for loop when removing child nodes from mat-icon #12073

wants to merge 45 commits into from

Conversation

pavel-agarkov
Copy link
Contributor

when mat-icon element has more than one child node (like when mat-badge is used) then child nodes should be removed in the reversed order otherwise you will attempt to get node by index which is not correct any more since you've deleted some nodes already in the previous iterations and it will cause an error.

tinayuangao and others added 30 commits June 20, 2018 11:05
Currently we use an rgba color for the table's sorting arrow which ends up looking weird, because the arrow is made up of multiple stacked elements. These changes add some logic that convert the arrow's color into a solid one so the individual pieces can blend into each other.

Fixes #11340.
… is opened (#11537)

Considers a select as focused as long as a its panel is open, even if the trigger loses focus. This avoids cases where the label can be seen blinking in the background when an option is toggled in multi-select mode.
…first open (#11707)

Fixes the menu's panel position not being accurate if it's `xPosition` or `yPosition` is updated after it has been opened for the first time.

Fixes #11668.
`OverlayRef` structurally matches `OverlayReference`, but does not
explicitly implement it. That works in TypeScript, and should work in
Closure Compiler through the use of `@record`, but for unclear reasons
doesn't.

Explicitly implementing the interface makes this code clearer, and works
around the problem in Closure Compiler while that is being fixed.
crisbeto and others added 7 commits June 29, 2018 10:44
when `mat-icon` element has more than one child node (like when `mat-badge` is used) then child nodes should be removed in the reversed order otherwise you will attempt to get node by index which is not correct any more since you've deleted some nodes already in the previous iterations.
@pavel-agarkov pavel-agarkov requested a review from jelbourn as a code owner July 5, 2018 12:04
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

@googlebot googlebot added the cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla label Jul 5, 2018
@pavel-agarkov
Copy link
Contributor Author

CLA is signed

@googlebot
Copy link

CLAs look good, thanks!

@googlebot googlebot added cla: yes PR author has agreed to Google's Contributor License Agreement and removed cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla labels Jul 5, 2018
@pavel-agarkov pavel-agarkov changed the title reverse for loop when removing child nodes from mat-icon fix (mat-icon): reverse for loop when removing child nodes from mat-icon Jul 5, 2018
@pavel-agarkov pavel-agarkov changed the title fix (mat-icon): reverse for loop when removing child nodes from mat-icon fix(icon): reverse for loop when removing child nodes from mat-icon Jul 5, 2018
@@ -200,7 +200,7 @@ export class MatIcon extends _MatIconMixinBase implements OnChanges, OnInit, Can

// Remove existing non-element child nodes and SVGs, and add the new SVG element. Note that
// we can't use innerHTML, because IE will throw if the element has a data binding.
for (let i = 0; i < childCount; i++) {
for (let i = childCount - 1; i >= 0; i--) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be simplified to while (childCount--)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the loop is simplified as you suggested

@crisbeto
Copy link
Member

crisbeto commented Jul 5, 2018

@pavel-agarkov looks like you opened the PR against the wrong branch. It should be against master, but you're targeting 6.3.x.

@pavel-agarkov pavel-agarkov changed the base branch from 6.3.x to master July 5, 2018 19:11
@googlebot
Copy link

So there's good news and bad news.

👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there.

😕 The bad news is that it appears that one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that here in the pull request.

Note to project maintainer: This is a terminal state, meaning the cla/google commit status will not change from this state. It's up to you to confirm consent of the commit author(s) and merge this pull request when appropriate.

@googlebot googlebot added cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla and removed cla: yes PR author has agreed to Google's Contributor License Agreement labels Jul 5, 2018
@pavel-agarkov
Copy link
Contributor Author

@crisbeto, do I need to start from the scratch?

@pavel-agarkov
Copy link
Contributor Author

closed in favor of #12078

@pavel-agarkov pavel-agarkov deleted the patch-1 branch July 5, 2018 19:30
@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: no PR author must sign Google's Contributor License Agreement: https://opensource.google.com/docs/cla
Projects
None yet
Development

Successfully merging this pull request may close these issues.