update components

This commit is contained in:
Luke Pulverenti 2016-06-25 02:04:53 -04:00
parent 2d86f49653
commit ab58f98cc1
27 changed files with 276 additions and 129 deletions

View file

@ -1,6 +1,6 @@
{
"name": "iron-a11y-keys-behavior",
"version": "1.1.4",
"version": "1.1.5",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"web-components",
@ -30,14 +30,14 @@
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
},
"ignore": [],
"homepage": "https://github.com/polymerelements/iron-a11y-keys-behavior",
"_release": "1.1.4",
"homepage": "https://github.com/PolymerElements/iron-a11y-keys-behavior",
"_release": "1.1.5",
"_resolution": {
"type": "version",
"tag": "v1.1.4",
"commit": "36362671d1cee654758d0e2167548f9fdcff2805"
"tag": "v1.1.5",
"commit": "b6f935cf203b328651f96ac3d21979cac7c9c241"
},
"_source": "git://github.com/polymerelements/iron-a11y-keys-behavior.git",
"_source": "git://github.com/PolymerElements/iron-a11y-keys-behavior.git",
"_target": "^1.0.0",
"_originalSource": "polymerelements/iron-a11y-keys-behavior"
"_originalSource": "PolymerElements/iron-a11y-keys-behavior"
}

View file

@ -1,6 +1,6 @@
{
"name": "iron-a11y-keys-behavior",
"version": "1.1.4",
"version": "1.1.5",
"description": "A behavior that enables keybindings for greater a11y.",
"keywords": [
"web-components",

View file

@ -391,24 +391,23 @@ subject to an additional IP rights grant found at http://polymer.github.io/PATEN
_resetKeyEventListeners: function() {
this._unlistenKeyEventListeners();
if (this.isAttached && this.keyEventTarget) {
if (this.isAttached) {
this._listenKeyEventListeners();
}
},
_listenKeyEventListeners: function () {
_listenKeyEventListeners: function() {
if (!this.keyEventTarget) {
return;
}
Object.keys(this._keyBindings).forEach(function(eventName) {
var keyBindings = this._keyBindings[eventName];
var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings);
if (this.keyEventTarget) {
Object.keys(this._keyBindings).forEach(function (eventName) {
var keyBindings = this._keyBindings[eventName];
var boundKeyHandler = this._onKeyBindingEvent.bind(this, keyBindings);
this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyHandler]);
this._boundKeyHandlers.push([this.keyEventTarget, eventName, boundKeyHandler]);
this.keyEventTarget.addEventListener(eventName, boundKeyHandler);
}, this);
}
this.keyEventTarget.addEventListener(eventName, boundKeyHandler);
}, this);
},
_unlistenKeyEventListeners: function() {

View file

@ -431,6 +431,15 @@ suite('Polymer.IronA11yKeysBehavior', function() {
});
});
suite('remove key behavior with null target', function () {
test('add and remove a iron-a11y-keys-behavior', function () {
var element = document.createElement('x-a11y-basic-keys');
element.keyEventTarget = null;
document.body.appendChild(element);
document.body.removeChild(element);
});
});
});
</script>
</body>