| OLD | NEW |
| 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 Loading... |
| 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 EventTarget that will be firing relevant KeyboardEvents. Set it t
o | 239 * The HTMLElement that will be firing relevant KeyboardEvents. |
| 240 * `null` to disable the listeners. | |
| 241 * @type {?EventTarget} | |
| 242 */ | 240 */ |
| 243 keyEventTarget: { | 241 keyEventTarget: { |
| 244 type: Object, | 242 type: Object, |
| 245 value: function() { | 243 value: function() { |
| 246 return this; | 244 return this; |
| 247 } | 245 } |
| 248 }, | 246 }, |
| 249 | 247 |
| 250 /** | 248 /** |
| 251 * If true, this property will cause the implementing element to | 249 * If true, this property will cause the implementing element to |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 371 this._keyBindings[keyCombo.event].push([ | 369 this._keyBindings[keyCombo.event].push([ |
| 372 keyCombo, | 370 keyCombo, |
| 373 handlerName | 371 handlerName |
| 374 ]); | 372 ]); |
| 375 }, this); | 373 }, this); |
| 376 }, | 374 }, |
| 377 | 375 |
| 378 _resetKeyEventListeners: function() { | 376 _resetKeyEventListeners: function() { |
| 379 this._unlistenKeyEventListeners(); | 377 this._unlistenKeyEventListeners(); |
| 380 | 378 |
| 381 if (this.isAttached && this.keyEventTarget) { | 379 if (this.isAttached) { |
| 382 this._listenKeyEventListeners(); | 380 this._listenKeyEventListeners(); |
| 383 } | 381 } |
| 384 }, | 382 }, |
| 385 | 383 |
| 386 _listenKeyEventListeners: function() { | 384 _listenKeyEventListeners: function() { |
| 387 Object.keys(this._keyBindings).forEach(function(eventName) { | 385 Object.keys(this._keyBindings).forEach(function(eventName) { |
| 388 var keyBindings = this._keyBindings[eventName]; | 386 var keyBindings = this._keyBindings[eventName]; |
| 389 var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings); | 387 var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings); |
| 390 | 388 |
| 391 this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyH
andler]); | 389 this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyH
andler]); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 detail: detail, | 439 detail: detail, |
| 442 cancelable: true | 440 cancelable: true |
| 443 }); | 441 }); |
| 444 this[handlerName].call(this, event); | 442 this[handlerName].call(this, event); |
| 445 if (event.defaultPrevented) { | 443 if (event.defaultPrevented) { |
| 446 keyboardEvent.preventDefault(); | 444 keyboardEvent.preventDefault(); |
| 447 } | 445 } |
| 448 } | 446 } |
| 449 }; | 447 }; |
| 450 })(); | 448 })(); |
| OLD | NEW |