-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Conversation
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.
`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.
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.
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. What to do if you already signed the CLAIndividual signers
Corporate signers
|
CLA is signed |
CLAs look good, thanks! |
src/lib/icon/icon.ts
Outdated
@@ -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--) { |
There was a problem hiding this comment.
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--)
There was a problem hiding this comment.
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
@pavel-agarkov looks like you opened the PR against the wrong branch. It should be against |
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 |
@crisbeto, do I need to start from the scratch? |
closed in favor of #12078 |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
when
mat-icon
element has more than one child node (like whenmat-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.