@@ -11,6 +11,7 @@ import {
1111} from '@angular/core' ;
1212import { coerceBooleanProperty , FocusOriginMonitor } from '../core' ;
1313import { mixinDisabled , CanDisable } from '../core/common-behaviors/disabled' ;
14+ import { isBrowser } from '../core/platform/browser' ;
1415
1516
1617// TODO(kara): Convert attribute selectors to classes when attr maps become available
@@ -22,9 +23,7 @@ import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';
2223 */
2324@Directive ( {
2425 selector : 'button[md-button], button[mat-button], a[md-button], a[mat-button]' ,
25- host : {
26- '[class.mat-button]' : 'true'
27- }
26+ host : { 'class' : 'mat-button' }
2827} )
2928export class MdButtonCssMatStyler { }
3029
@@ -36,9 +35,7 @@ export class MdButtonCssMatStyler {}
3635 selector :
3736 'button[md-raised-button], button[mat-raised-button], ' +
3837 'a[md-raised-button], a[mat-raised-button]' ,
39- host : {
40- '[class.mat-raised-button]' : 'true'
41- }
38+ host : { 'class' : 'mat-raised-button' }
4239} )
4340export class MdRaisedButtonCssMatStyler { }
4441
@@ -49,9 +46,7 @@ export class MdRaisedButtonCssMatStyler {}
4946@Directive ( {
5047 selector :
5148 'button[md-icon-button], button[mat-icon-button], a[md-icon-button], a[mat-icon-button]' ,
52- host : {
53- '[class.mat-icon-button]' : 'true' ,
54- }
49+ host : { 'class' : 'mat-icon-button' }
5550} )
5651export class MdIconButtonCssMatStyler { }
5752
@@ -61,9 +56,7 @@ export class MdIconButtonCssMatStyler {}
6156 */
6257@Directive ( {
6358 selector : 'button[md-fab], button[mat-fab], a[md-fab], a[mat-fab]' ,
64- host : {
65- '[class.mat-fab]' : 'true'
66- }
59+ host : { 'class' : 'mat-fab' }
6760} )
6861export class MdFabCssMatStyler { }
6962
@@ -73,9 +66,7 @@ export class MdFabCssMatStyler {}
7366 */
7467@Directive ( {
7568 selector : 'button[md-mini-fab], button[mat-mini-fab], a[md-mini-fab], a[mat-mini-fab]' ,
76- host : {
77- '[class.mat-mini-fab]' : 'true'
78- }
69+ host : { 'class' : 'mat-mini-fab' }
7970} )
8071export class MdMiniFabCssMatStyler { }
8172
@@ -165,6 +156,13 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
165156 * with either an 'md-' or 'mat-' prefix.
166157 */
167158 _hasAttributeWithPrefix ( ...unprefixedAttributeNames : string [ ] ) {
159+ // If not on the browser, say that there are none of the attributes present.
160+ // Since these only affect how the ripple displays (and ripples only happen on the client),
161+ // detecting these attributes isn't necessary when not on the browser.
162+ if ( ! isBrowser ( ) ) {
163+ return false ;
164+ }
165+
168166 return unprefixedAttributeNames . some ( suffix => {
169167 const el = this . _getHostElement ( ) ;
170168
0 commit comments