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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-menu-behavior/iron-menu-behavior-extracted.js

Issue 2158913007: Roll Polymer from 1.5.0 -> 1.6.0 to pick up native CSS custom props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 4 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 * `Polymer.IronMenuBehavior` implements accessible menu behavior. 2 * `Polymer.IronMenuBehavior` implements accessible menu behavior.
3 * 3 *
4 * @demo demo/index.html 4 * @demo demo/index.html
5 * @polymerBehavior Polymer.IronMenuBehavior 5 * @polymerBehavior Polymer.IronMenuBehavior
6 */ 6 */
7 Polymer.IronMenuBehaviorImpl = { 7 Polymer.IronMenuBehaviorImpl = {
8 8
9 properties: { 9 properties: {
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.k eyCode).toLowerCase()) { 116 title.trim().charAt(0).toLowerCase() === String.fromCharCode(event.k eyCode).toLowerCase()) {
117 this._setFocusedItem(item); 117 this._setFocusedItem(item);
118 break; 118 break;
119 } 119 }
120 } 120 }
121 }, 121 },
122 122
123 /** 123 /**
124 * Focuses the previous item (relative to the currently focused item) in the 124 * Focuses the previous item (relative to the currently focused item) in the
125 * menu, disabled items will be skipped. 125 * menu, disabled items will be skipped.
126 * Loop until length + 1 to handle case of single item in menu.
126 */ 127 */
127 _focusPrevious: function() { 128 _focusPrevious: function() {
128 var length = this.items.length; 129 var length = this.items.length;
129 var curFocusIndex = Number(this.indexOf(this.focusedItem)); 130 var curFocusIndex = Number(this.indexOf(this.focusedItem));
130 for (var i = 1; i < length; i++) { 131 for (var i = 1; i < length + 1; i++) {
131 var item = this.items[(curFocusIndex - i + length) % length]; 132 var item = this.items[(curFocusIndex - i + length) % length];
132 if (!item.hasAttribute('disabled')) { 133 if (!item.hasAttribute('disabled')) {
133 this._setFocusedItem(item); 134 this._setFocusedItem(item);
134 return; 135 return;
135 } 136 }
136 } 137 }
137 }, 138 },
138 139
139 /** 140 /**
140 * Focuses the next item (relative to the currently focused item) in the 141 * Focuses the next item (relative to the currently focused item) in the
141 * menu, disabled items will be skipped. 142 * menu, disabled items will be skipped.
143 * Loop until length + 1 to handle case of single item in menu.
142 */ 144 */
143 _focusNext: function() { 145 _focusNext: function() {
144 var length = this.items.length; 146 var length = this.items.length;
145 var curFocusIndex = Number(this.indexOf(this.focusedItem)); 147 var curFocusIndex = Number(this.indexOf(this.focusedItem));
146 for (var i = 1; i < length; i++) { 148 for (var i = 1; i < length + 1; i++) {
147 var item = this.items[(curFocusIndex + i) % length]; 149 var item = this.items[(curFocusIndex + i) % length];
148 if (!item.hasAttribute('disabled')) { 150 if (!item.hasAttribute('disabled')) {
149 this._setFocusedItem(item); 151 this._setFocusedItem(item);
150 return; 152 return;
151 } 153 }
152 } 154 }
153 }, 155 },
154 156
155 /** 157 /**
156 * Mutates items in the menu based on provided selection details, so that 158 * Mutates items in the menu based on provided selection details, so that
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 }; 309 };
308 310
309 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false; 311 Polymer.IronMenuBehaviorImpl._shiftTabPressed = false;
310 312
311 /** @polymerBehavior Polymer.IronMenuBehavior */ 313 /** @polymerBehavior Polymer.IronMenuBehavior */
312 Polymer.IronMenuBehavior = [ 314 Polymer.IronMenuBehavior = [
313 Polymer.IronMultiSelectableBehavior, 315 Polymer.IronMultiSelectableBehavior,
314 Polymer.IronA11yKeysBehavior, 316 Polymer.IronA11yKeysBehavior,
315 Polymer.IronMenuBehaviorImpl 317 Polymer.IronMenuBehaviorImpl
316 ]; 318 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698