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

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

Issue 2092213003: [MD settings] update polymer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 (function() { 1 (function() {
2 'use strict'; 2 'use strict';
3 3
4 /** 4 /**
5 * Chrome uses an older version of DOM Level 3 Keyboard Events 5 * Chrome uses an older version of DOM Level 3 Keyboard Events
6 * 6 *
7 * Most keys are labeled as text, but some are Unicode codepoints. 7 * Most keys are labeled as text, but some are Unicode codepoints.
8 * Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-200712 21/keyset.html#KeySet-Set 8 * Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-200712 21/keyset.html#KeySet-Set
9 */ 9 */
10 var KEY_IDENTIFIER = { 10 var KEY_IDENTIFIER = {
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 * node. 229 * node.
230 * The `keys-pressed` event will fire when one of the key combinations set w ith the 230 * The `keys-pressed` event will fire when one of the key combinations set w ith the
231 * `keys` property is pressed. 231 * `keys` property is pressed.
232 * 232 *
233 * @demo demo/index.html 233 * @demo demo/index.html
234 * @polymerBehavior 234 * @polymerBehavior
235 */ 235 */
236 Polymer.IronA11yKeysBehavior = { 236 Polymer.IronA11yKeysBehavior = {
237 properties: { 237 properties: {
238 /** 238 /**
239 * The HTMLElement that will be firing relevant KeyboardEvents. 239 * The EventTarget that will be firing relevant KeyboardEvents. Set it t o
240 * `null` to disable the listeners.
241 * @type {?EventTarget}
240 */ 242 */
241 keyEventTarget: { 243 keyEventTarget: {
242 type: Object, 244 type: Object,
243 value: function() { 245 value: function() {
244 return this; 246 return this;
245 } 247 }
246 }, 248 },
247 249
248 /** 250 /**
249 * If true, this property will cause the implementing element to 251 * If true, this property will cause the implementing element to
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 377
376 _resetKeyEventListeners: function() { 378 _resetKeyEventListeners: function() {
377 this._unlistenKeyEventListeners(); 379 this._unlistenKeyEventListeners();
378 380
379 if (this.isAttached) { 381 if (this.isAttached) {
380 this._listenKeyEventListeners(); 382 this._listenKeyEventListeners();
381 } 383 }
382 }, 384 },
383 385
384 _listenKeyEventListeners: function() { 386 _listenKeyEventListeners: function() {
387 if (!this.keyEventTarget) {
388 return;
389 }
385 Object.keys(this._keyBindings).forEach(function(eventName) { 390 Object.keys(this._keyBindings).forEach(function(eventName) {
386 var keyBindings = this._keyBindings[eventName]; 391 var keyBindings = this._keyBindings[eventName];
387 var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings); 392 var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings);
388 393
389 this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyH andler]); 394 this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyH andler]);
390 395
391 this.keyEventTarget.addEventListener(eventName, boundKeyHandler); 396 this.keyEventTarget.addEventListener(eventName, boundKeyHandler);
392 }, this); 397 }, this);
393 }, 398 },
394 399
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 detail: detail, 444 detail: detail,
440 cancelable: true 445 cancelable: true
441 }); 446 });
442 this[handlerName].call(this, event); 447 this[handlerName].call(this, event);
443 if (event.defaultPrevented) { 448 if (event.defaultPrevented) {
444 keyboardEvent.preventDefault(); 449 keyboardEvent.preventDefault();
445 } 450 }
446 } 451 }
447 }; 452 };
448 })(); 453 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698