| OLD | NEW |
| 1 | 1 |
| 2 (function() { | 2 (function() { |
| 3 'use strict'; | 3 'use strict'; |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * Chrome uses an older version of DOM Level 3 Keyboard Events | 6 * Chrome uses an older version of DOM Level 3 Keyboard Events |
| 7 * | 7 * |
| 8 * Most keys are labeled as text, but some are Unicode codepoints. | 8 * Most keys are labeled as text, but some are Unicode codepoints. |
| 9 * Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-200712
21/keyset.html#KeySet-Set | 9 * Values taken from: http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-200712
21/keyset.html#KeySet-Set |
| 10 */ | 10 */ |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 * and uses an expressive syntax to filter key presses. | 221 * and uses an expressive syntax to filter key presses. |
| 222 * | 222 * |
| 223 * Use the `keyBindings` prototype property to express what combination of k
eys | 223 * Use the `keyBindings` prototype property to express what combination of k
eys |
| 224 * will trigger the event to fire. | 224 * will trigger the event to fire. |
| 225 * | 225 * |
| 226 * Use the `key-event-target` attribute to set up event handlers on a specif
ic | 226 * Use the `key-event-target` attribute to set up event handlers on a specif
ic |
| 227 * node. | 227 * node. |
| 228 * The `keys-pressed` event will fire when one of the key combinations set w
ith the | 228 * The `keys-pressed` event will fire when one of the key combinations set w
ith the |
| 229 * `keys` property is pressed. | 229 * `keys` property is pressed. |
| 230 * | 230 * |
| 231 * @demo demo/index.html |
| 231 * @polymerBehavior IronA11yKeysBehavior | 232 * @polymerBehavior IronA11yKeysBehavior |
| 232 */ | 233 */ |
| 233 Polymer.IronA11yKeysBehavior = { | 234 Polymer.IronA11yKeysBehavior = { |
| 234 properties: { | 235 properties: { |
| 235 /** | 236 /** |
| 236 * The HTMLElement that will be firing relevant KeyboardEvents. | 237 * The HTMLElement that will be firing relevant KeyboardEvents. |
| 237 */ | 238 */ |
| 238 keyEventTarget: { | 239 keyEventTarget: { |
| 239 type: Object, | 240 type: Object, |
| 240 value: function() { | 241 value: function() { |
| 241 return this; | 242 return this; |
| 242 } | 243 } |
| 243 }, | 244 }, |
| 244 | 245 |
| 245 _boundKeyHandlers: { | 246 _boundKeyHandlers: { |
| 247 type: Array, |
| 246 value: function() { | 248 value: function() { |
| 247 return []; | 249 return []; |
| 248 } | 250 } |
| 249 }, | 251 }, |
| 250 | 252 |
| 251 // We use this due to a limitation in IE10 where instances will have | 253 // We use this due to a limitation in IE10 where instances will have |
| 252 // own properties of everything on the "prototype". | 254 // own properties of everything on the "prototype". |
| 253 _imperativeKeyBindings: { | 255 _imperativeKeyBindings: { |
| 256 type: Object, |
| 254 value: function() { | 257 value: function() { |
| 255 return {}; | 258 return {}; |
| 256 } | 259 } |
| 257 } | 260 } |
| 258 }, | 261 }, |
| 259 | 262 |
| 260 observers: [ | 263 observers: [ |
| 261 '_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)' | 264 '_resetKeyEventListeners(keyEventTarget, _boundKeyHandlers)' |
| 262 ], | 265 ], |
| 263 | 266 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 _triggerKeyHandler: function(keyCombo, handlerName, keyboardEvent) { | 399 _triggerKeyHandler: function(keyCombo, handlerName, keyboardEvent) { |
| 397 var detail = Object.create(keyCombo); | 400 var detail = Object.create(keyCombo); |
| 398 detail.keyboardEvent = keyboardEvent; | 401 detail.keyboardEvent = keyboardEvent; |
| 399 | 402 |
| 400 this[handlerName].call(this, new CustomEvent(keyCombo.event, { | 403 this[handlerName].call(this, new CustomEvent(keyCombo.event, { |
| 401 detail: detail | 404 detail: detail |
| 402 })); | 405 })); |
| 403 } | 406 } |
| 404 }; | 407 }; |
| 405 })(); | 408 })(); |
| OLD | NEW |