Skip to content

Commit 57c8f05

Browse files
devversionjosephperrott
authored andcommitted
chore(button): remove prefix specific checks (#7843)
1 parent 8178d6f commit 57c8f05

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/lib/button/button.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ export class MatButton extends _MatButtonMixinBase
131131
implements OnDestroy, CanDisable, CanColor, CanDisableRipple {
132132

133133
/** Whether the button is round. */
134-
_isRoundButton: boolean = this._hasAttributeWithPrefix('fab', 'mini-fab');
134+
_isRoundButton: boolean = this._hasHostAttributes('mat-fab', 'mat-mini-fab');
135135

136136
/** Whether the button is icon button. */
137-
_isIconButton: boolean = this._hasAttributeWithPrefix('icon-button');
137+
_isIconButton: boolean = this._hasHostAttributes('mat-icon-button');
138138

139139
constructor(renderer: Renderer2,
140140
elementRef: ElementRef,
@@ -161,18 +161,16 @@ export class MatButton extends _MatButtonMixinBase
161161
return this.disableRipple || this.disabled;
162162
}
163163

164-
/** Gets whether the button has one of the given attributes with a 'mat-' prefix. */
165-
_hasAttributeWithPrefix(...unprefixedAttributeNames: string[]) {
164+
/** Gets whether the button has one of the given attributes. */
165+
_hasHostAttributes(...attributes: string[]) {
166166
// If not on the browser, say that there are none of the attributes present.
167167
// Since these only affect how the ripple displays (and ripples only happen on the client),
168168
// detecting these attributes isn't necessary when not on the browser.
169169
if (!this._platform.isBrowser) {
170170
return false;
171171
}
172172

173-
return unprefixedAttributeNames.some(suffix => {
174-
return this._getHostElement().hasAttribute('mat-' + suffix);
175-
});
173+
return attributes.some(attribute => this._getHostElement().hasAttribute(attribute));
176174
}
177175
}
178176

0 commit comments

Comments
 (0)