Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(12)

Side by Side Diff: third_party/polymer/components/iron-behaviors/iron-button-state.html

Issue 3010683002: Update Polymer components. (Closed)
Patch Set: Rebase Created 3 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 <!-- 1 <!--
2 @license 2 @license
3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved. 3 Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt 4 This code may only be used under the BSD style license found at http://polymer.g ithub.io/LICENSE.txt
5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt 5 The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt 6 The complete set of contributors may be found at http://polymer.github.io/CONTRI BUTORS.txt
7 Code distributed by Google as part of the polymer project is also 7 Code distributed by Google as part of the polymer project is also
8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt 8 subject to an additional IP rights grant found at http://polymer.github.io/PATEN TS.txt
9 --> 9 -->
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 }, 85 },
86 86
87 listeners: { 87 listeners: {
88 down: '_downHandler', 88 down: '_downHandler',
89 up: '_upHandler', 89 up: '_upHandler',
90 tap: '_tapHandler' 90 tap: '_tapHandler'
91 }, 91 },
92 92
93 observers: [ 93 observers: [
94 '_detectKeyboardFocus(focused)', 94 '_focusChanged(focused)',
95 '_activeChanged(active, ariaActiveAttribute)' 95 '_activeChanged(active, ariaActiveAttribute)'
96 ], 96 ],
97 97
98 keyBindings: { 98 keyBindings: {
99 'enter:keydown': '_asyncClick', 99 'enter:keydown': '_asyncClick',
100 'space:keydown': '_spaceKeyDownHandler', 100 'space:keydown': '_spaceKeyDownHandler',
101 'space:keyup': '_spaceKeyUpHandler', 101 'space:keyup': '_spaceKeyUpHandler',
102 }, 102 },
103 103
104 _mouseEventRe: /^mouse/, 104 _mouseEventRe: /^mouse/,
105 105
106 _tapHandler: function() { 106 _tapHandler: function() {
107 if (this.toggles) { 107 if (this.toggles) {
108 // a tap is needed to toggle the active state 108 // a tap is needed to toggle the active state
109 this._userActivate(!this.active); 109 this._userActivate(!this.active);
110 } else { 110 } else {
111 this.active = false; 111 this.active = false;
112 } 112 }
113 }, 113 },
114 114
115 _focusChanged: function(focused) {
116 this._detectKeyboardFocus(focused);
117
118 if (!focused) {
119 this._setPressed(false);
120 }
121 },
122
115 _detectKeyboardFocus: function(focused) { 123 _detectKeyboardFocus: function(focused) {
116 this._setReceivedFocusFromKeyboard(!this.pointerDown && focused); 124 this._setReceivedFocusFromKeyboard(!this.pointerDown && focused);
117 }, 125 },
118 126
119 // to emulate native checkbox, (de-)activations from a user interaction fire 127 // to emulate native checkbox, (de-)activations from a user interaction fire
120 // 'change' events 128 // 'change' events
121 _userActivate: function(active) { 129 _userActivate: function(active) {
122 if (this.active !== active) { 130 if (this.active !== active) {
123 this.active = active; 131 this.active = active;
124 this.fire('change'); 132 this.fire('change');
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 227
220 }; 228 };
221 229
222 /** @polymerBehavior */ 230 /** @polymerBehavior */
223 Polymer.IronButtonState = [ 231 Polymer.IronButtonState = [
224 Polymer.IronA11yKeysBehavior, 232 Polymer.IronA11yKeysBehavior,
225 Polymer.IronButtonStateImpl 233 Polymer.IronButtonStateImpl
226 ]; 234 ];
227 235
228 </script> 236 </script>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698