-
Notifications
You must be signed in to change notification settings - Fork 6.8k
fix(button): avoid direct access to nativeElement for consistency #16056
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(button): avoid direct access to nativeElement for consistency #16056
Conversation
src/material/button/button.ts
Outdated
@@ -98,7 +98,7 @@ export class MatButton extends _MatButtonMixinBase | |||
// attributes, add the correct corresponding class. | |||
for (const attr of BUTTON_HOST_ATTRIBUTES) { | |||
if (this._hasHostAttributes(attr)) { | |||
(elementRef.nativeElement as HTMLElement).classList.add(attr); | |||
this._getHostElement().classList.add(attr); |
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.
Could you also add a return type of HTMLElement
to _getHostElement
in this PR? That will ensure that the type safety remains
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.
Done :-)
57ae009
to
facdaf5
Compare
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.
LGTM
Commit message should be:
|
facdaf5
to
6edd0d3
Compare
Done. |
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. |
No description provided.