9
9
Renderer2 ,
10
10
ViewEncapsulation
11
11
} from '@angular/core' ;
12
- import { coerceBooleanProperty , FocusOriginMonitor } from '../core' ;
12
+ import { coerceBooleanProperty , FocusOriginMonitor , Platform } from '../core' ;
13
13
import { mixinDisabled , CanDisable } from '../core/common-behaviors/disabled' ;
14
14
15
15
@@ -22,9 +22,7 @@ import {mixinDisabled, CanDisable} from '../core/common-behaviors/disabled';
22
22
*/
23
23
@Directive ( {
24
24
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' }
28
26
} )
29
27
export class MdButtonCssMatStyler { }
30
28
@@ -36,9 +34,7 @@ export class MdButtonCssMatStyler {}
36
34
selector :
37
35
'button[md-raised-button], button[mat-raised-button], ' +
38
36
'a[md-raised-button], a[mat-raised-button]' ,
39
- host : {
40
- '[class.mat-raised-button]' : 'true'
41
- }
37
+ host : { 'class' : 'mat-raised-button' }
42
38
} )
43
39
export class MdRaisedButtonCssMatStyler { }
44
40
@@ -49,9 +45,7 @@ export class MdRaisedButtonCssMatStyler {}
49
45
@Directive ( {
50
46
selector :
51
47
'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' }
55
49
} )
56
50
export class MdIconButtonCssMatStyler { }
57
51
@@ -61,9 +55,7 @@ export class MdIconButtonCssMatStyler {}
61
55
*/
62
56
@Directive ( {
63
57
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' }
67
59
} )
68
60
export class MdFabCssMatStyler { }
69
61
@@ -73,9 +65,7 @@ export class MdFabCssMatStyler {}
73
65
*/
74
66
@Directive ( {
75
67
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' }
79
69
} )
80
70
export class MdMiniFabCssMatStyler { }
81
71
@@ -120,8 +110,11 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
120
110
get disableRipple ( ) { return this . _disableRipple ; }
121
111
set disableRipple ( v ) { this . _disableRipple = coerceBooleanProperty ( v ) ; }
122
112
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 ) {
125
118
super ( ) ;
126
119
this . _focusOriginMonitor . monitor ( this . _elementRef . nativeElement , this . _renderer , true ) ;
127
120
}
@@ -169,6 +162,13 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
169
162
* with either an 'md-' or 'mat-' prefix.
170
163
*/
171
164
_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
+
172
172
return unprefixedAttributeNames . some ( suffix => {
173
173
const el = this . _getHostElement ( ) ;
174
174
@@ -195,8 +195,12 @@ export class MdButton extends _MdButtonMixinBase implements OnDestroy, CanDisabl
195
195
encapsulation : ViewEncapsulation . None
196
196
} )
197
197
export 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 ) ;
200
204
}
201
205
202
206
/** @docs -private */
0 commit comments