I noticed a strange problem with how Chrome handles the javascript focus event. The fact is that it constantly raises a focusing event, even if it happens only once. I did some research here and found questions when people encounter one problem when using alert (). When they close the warning window, the focus returns to its inputs, and the handler starts again and again. In my case, the problem is different since I use console.log (), and from time to time I get the same log 2 or even 3 times. I noticed that this usually happens when I clean the console and then focus on the element. When I try to repeat this, it no longer happens.
Scenario:
- Clear console
- Focus on the item (2 or 3 console messages)
- Focus on another identical element or don't focus and focus on one again (no problem)
- Clear console
- Focus on the element (2 or 3 console messages - the problem has returned!)
I created jsfiddle, please check this:
http://jsfiddle.net/ffuWT/3/
The question is, what is the cause of this problem and how can I get around it?
source
share