4 ms·
What I like is that all the code is laid bare. You could add a line or two into the `_onKeyup` method which does this. These tags are sorted by popularity.
by Kequc 10y ago
What I like is that all the code is laid bare. You could add a line or two into the `_onKeyup` method which does this. These tags are sorted by popularity.
if (this.parts.suggestions && (e.which || e.charCode || e.keyCode) == 9) {
let foo = this.parts.suggestions.children.item(0);
if (foo) foo.click();
}
- justinlardinois 10y agoI'm a little confused; what's going on in the part of the main if condition after the &&? It looks like the author intended to check if any of e.which, e.charCode, or e.keyCode equal 9, but obviously that's not what would happen.
- sago 10y ago'obviously'? The code looks fine to me, c.f.: $ node > undefined || undefined || 4 4 > undefined || 9 || 4 9 The || operator evaluates to the first of its two operands if it is truthy, or its second operand otherwise > undefined || false false > false || undefined undefined So: > e = {keyCode:9} > e.which || e.charCode || e.keyCode 9