@@ -21,9 +21,9 @@ import {
21
21
inputs : [ 'color' ] ,
22
22
host : {
23
23
'[class.md-button-focus]' : 'isKeyboardFocused' ,
24
- '(mousedown)' : 'setMousedown ()' ,
25
- '(focus)' : 'setKeyboardFocus ()' ,
26
- '(blur)' : 'removeKeyboardFocus ()' ,
24
+ '(mousedown)' : '_setMousedown ()' ,
25
+ '(focus)' : '_setKeyboardFocus ()' ,
26
+ '(blur)' : '_removeKeyboardFocus ()' ,
27
27
} ,
28
28
templateUrl : 'button.html' ,
29
29
styleUrls : [ 'button.css' ] ,
@@ -34,12 +34,12 @@ export class MdButton {
34
34
private _color : string ;
35
35
36
36
/** Whether the button has focus from the keyboard (not the mouse). Used for class binding. */
37
- isKeyboardFocused : boolean = false ;
37
+ _isKeyboardFocused : boolean = false ;
38
38
39
39
/** Whether a mousedown has occurred on this element in the last 100ms. */
40
- isMouseDown : boolean = false ;
40
+ _isMouseDown : boolean = false ;
41
41
42
- constructor ( private elementRef : ElementRef , private renderer : Renderer ) { }
42
+ constructor ( private _elementRef : ElementRef , private _renderer : Renderer ) { }
43
43
44
44
get color ( ) : string {
45
45
return this . _color ;
@@ -49,14 +49,13 @@ export class MdButton {
49
49
this . _updateColor ( value ) ;
50
50
}
51
51
52
- /** @internal */
53
- setMousedown ( ) {
52
+ _setMousedown ( ) {
54
53
// We only *show* the focus style when focus has come to the button via the keyboard.
55
54
// The Material Design spec is silent on this topic, and without doing this, the
56
55
// button continues to look :active after clicking.
57
56
// @see http://marcysutton.com/button-focus-hell/
58
- this . isMouseDown = true ;
59
- setTimeout ( ( ) => { this . isMouseDown = false ; } , 100 ) ;
57
+ this . _isMouseDown = true ;
58
+ setTimeout ( ( ) => { this . _isMouseDown = false ; } , 100 ) ;
60
59
}
61
60
62
61
_updateColor ( newColor : string ) {
@@ -67,23 +66,21 @@ export class MdButton {
67
66
68
67
_setElementColor ( color : string , isAdd : boolean ) {
69
68
if ( color != null && color != '' ) {
70
- this . renderer . setElementClass ( this . elementRef . nativeElement , `md-${ color } ` , isAdd ) ;
69
+ this . _renderer . setElementClass ( this . _elementRef . nativeElement , `md-${ color } ` , isAdd ) ;
71
70
}
72
71
}
73
72
74
- /** @internal */
75
- setKeyboardFocus ( ) {
76
- this . isKeyboardFocused = ! this . isMouseDown ;
73
+ _setKeyboardFocus ( ) {
74
+ this . _isKeyboardFocused = ! this . _isMouseDown ;
77
75
}
78
76
79
- /** @internal */
80
- removeKeyboardFocus ( ) {
81
- this . isKeyboardFocused = false ;
77
+ _removeKeyboardFocus ( ) {
78
+ this . _isKeyboardFocused = false ;
82
79
}
83
80
84
81
/** TODO(hansl): e2e test this function. */
85
82
focus ( ) {
86
- this . elementRef . nativeElement . focus ( ) ;
83
+ this . _elementRef . nativeElement . focus ( ) ;
87
84
}
88
85
}
89
86
@@ -92,11 +89,11 @@ export class MdButton {
92
89
selector : 'a[md-button], a[md-raised-button], a[md-icon-button], a[md-fab], a[md-mini-fab]' ,
93
90
inputs : [ 'color' ] ,
94
91
host : {
95
- '[class.md-button-focus]' : 'isKeyboardFocused ' ,
96
- '(mousedown)' : 'setMousedown ()' ,
97
- '(focus)' : 'setKeyboardFocus ()' ,
98
- '(blur)' : 'removeKeyboardFocus ()' ,
99
- '(click)' : 'haltDisabledEvents ($event)' ,
92
+ '[class.md-button-focus]' : '_isKeyboardFocused ' ,
93
+ '(mousedown)' : '_setMousedown ()' ,
94
+ '(focus)' : '_setKeyboardFocus ()' ,
95
+ '(blur)' : '_removeKeyboardFocus ()' ,
96
+ '(click)' : '_haltDisabledEvents ($event)' ,
100
97
} ,
101
98
templateUrl : 'button.html' ,
102
99
styleUrls : [ 'button.css' ] ,
@@ -129,8 +126,7 @@ export class MdAnchor extends MdButton {
129
126
this . _disabled = ( value != null && value != false ) ? true : null ;
130
127
}
131
128
132
- /** @internal */
133
- haltDisabledEvents ( event : Event ) {
129
+ _haltDisabledEvents ( event : Event ) {
134
130
// A disabled button shouldn't apply any actions
135
131
if ( this . disabled ) {
136
132
event . preventDefault ( ) ;
0 commit comments