-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
guard against null keyEventTarget #48
Conversation
There are two calls to _listenKeyEventListeners() and one already guards against null this.keyEventTarget. This change guards the call to _listenKeyEventListeners in attached from using a null keyEventTarget.
/cc @valdrinkoshi, @dbeam |
It may be worth moving the keyEventTarget check into _listenKeyEventListeners() rather than checking keyEventTarget before calling _listenKeyEventListeners(). WDYT? |
Moving the keyEventTarget check into _listenKeyEventListeners()
this._listenKeyEventListeners(); | ||
} | ||
}, | ||
|
||
_listenKeyEventListeners: function() { | ||
if (!this.keyEventTarget) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's a much better place for this check! 🍻
Thanks for the contribution @dschuyler! |
Fixes #49 |
var element = document.createElement('x-a11y-basic-keys'); | ||
element.keyEventTarget = null; | ||
Polymer.dom(container).appendChild(element); | ||
done(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: since the test is synchronous, you don't need to have to call the done callback (remove it from here and from line 444)
LGTM, thanks for your contribution @dschuyler! |
There are two calls to _listenKeyEventListeners() and one already guards against null this.keyEventTarget. This change guards the call to _listenKeyEventListeners in attached from using a null keyEventTarget.