don't depend on the order of events (focus has two variants in jQuery)
This commit is contained in:
parent
69a1718d08
commit
b0502ef07e
1 changed files with 4 additions and 1 deletions
|
|
@ -36,7 +36,10 @@ app.views.Header = app.views.Base.extend({
|
||||||
},
|
},
|
||||||
|
|
||||||
toggleSearchActive: function(ev) {
|
toggleSearchActive: function(ev) {
|
||||||
$(ev.target).toggleClass('active', ev.type=='focusin');
|
// jQuery produces two events for focus/blur (for bubbling)
|
||||||
|
// don't rely on which event arrives first, by allowing for both variants
|
||||||
|
var is_active = (_.indexOf(['focus','focusin'], ev.type) != -1);
|
||||||
|
$(ev.target).toggleClass('active', is_active);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue