99 Renderer2 ,
1010 ViewEncapsulation
1111} from '@angular/core' ;
12- import { coerceBooleanProperty , FocusOriginMonitor } from '../core' ;
12+ import { coerceBooleanProperty , FocusOriginMonitor , Platform } from '../core' ;
1313import { mixinDisabled , CanDisable } from '../core/common-behaviors/disabled' ;
1414
1515
@@ -22,9 +22,7 @@ import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';
2222 */
2323@Directive ( {
2424 selector : 'button[md-button], button[mat-button], a[md-button], a[mat-button]' ,
25- host : {
26- '[class.mat-button]' : 'true'
27- }
25+ host : { 'class' : 'mat-button' }
2826} )
2927export class MdButtonCssMatStyler { }
3028
@@ -36,9 +34,7 @@ export class MdButtonCssMatStyler {}
3634 selector :
3735 'button[md-raised-button], button[mat-raised-button], ' +
3836 'a[md-raised-button], a[mat-raised-button]' ,
39- host : {
40- '[class.mat-raised-button]' : 'true'
41- }
37+ host : { 'class' : 'mat-raised-button' }
4238} )
4339export class MdRaisedButtonCssMatStyler { }
4440
@@ -49,9 +45,7 @@ export class MdRaisedButtonCssMatStyler {}
4945@Directive ( {
5046 selector :
5147 '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- }
48+ host : { 'class' : 'mat-icon-button' }
5549} )
5650export class MdIconButtonCssMatStyler { }
5751
@@ -61,9 +55,7 @@ export class MdIconButtonCssMatStyler {}
6155 */
6256@Directive ( {
6357 selector : 'button[md-fab], button[mat-fab], a[md-fab], a[mat-fab]' ,
64- host : {
65- '[class.mat-fab]' : 'true'
66- }
58+ host : { 'class' : 'mat-fab' }
6759} )
6860export class MdFabCssMatStyler { }
6961
@@ -73,9 +65,7 @@ export class MdFabCssMatStyler {}
7365 */
7466@Directive ( {
7567 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- }
68+ host : { 'class' : 'mat-mini-fab' }
7969} )
8070export class MdMiniFabCssMatStyler { }
8171
@@ -120,8 +110,11 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
120110 get disableRipple ( ) { return this . _disableRipple ; }
121111 set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
122112
123- constructor ( private _elementRef : ElementRef , private _renderer : Renderer2 ,
124- private _focusOriginMonitor : FocusOriginMonitor ) {
113+ constructor (
114+ private _elementRef : ElementRef ,
115+ private _renderer : Renderer2 ,
116+ private _platform : Platform ,
117+ private _focusOriginMonitor : FocusOriginMonitor ) {
125118 super ( ) ;
126119 this . _focusOriginMonitor . monitor ( this . _elementRef . nativeElement , this . _renderer , true ) ;
127120 }
@@ -169,6 +162,13 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
169162 * with either an 'md-' or 'mat-' prefix.
170163 */
171164 _hasAttributeWithPrefix ( ...unprefixedAttributeNames : string [ ] ) {
165+ // If not on the browser, say that there are none of the attributes present.
166+ // Since these only affect how the ripple displays (and ripples only happen on the client),
167+ // detecting these attributes isn't necessary when not on the browser.
168+ if ( ! this . _platform . isBrowser ) {
169+ return false ;
170+ }
171+
172172 return unprefixedAttributeNames . some ( suffix => {
173173 const el = this . _getHostElement ( ) ;
174174
@@ -195,8 +195,12 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
195195 encapsulation : ViewEncapsulation . None
196196} )
197197export class MdAnchor extends MdButton {
198- constructor ( elementRef : ElementRef , renderer : Renderer2 , focusOriginMonitor : FocusOriginMonitor ) {
199- super ( elementRef , renderer , focusOriginMonitor ) ;
198+ constructor (
199+ elementRef : ElementRef ,
200+ renderer : Renderer2 ,
201+ platform : Platform ,
202+ focusOriginMonitor : FocusOriginMonitor ) {
203+ super ( elementRef , renderer , platform , focusOriginMonitor ) ;
200204 }
201205
202206 /** @docs -private */
0 commit comments