Fast clicking on IE has slower response than firefox, chrome and safari. Why? (I'm using jquery)
views:
103answers:
4Fast clicking on IE has slower response than firefox, chrome and safari. Why? (I'm using jquery)
It is due to the speed of the JavaScript engine inside of the browser. IE is typically the slowest (depending on the version being used).
It's because Internet Explorer interprets two fast clicks in a row as one single-click, followed by one double-click, while the other browsers interpret it as two single-clicks and a double-click.
Try testing this to see how each browser reacts to a double-click.
<html>
<head>
<script type='text/javascript'>
function onclick_test()
{
var console = document.getElementById('console');
console.appendChild(document.createTextNode('onclick'));
console.appendChild(document.createElement('br'));
}
function ondblclick_test()
{
var console = document.getElementById('console');
console.appendChild(document.createTextNode('ondblclick'));
console.appendChild(document.createElement('br'));
}
</script>
</head>
<body>
<span style='border:1px solid blue;' onclick='onclick_test();' ondblclick='ondblclick_test();'>Click me</span>
<div id='console'></div>
</body>
</html>
I think the problem is that IE apparently doesn't fire click when it fires dblclick unlike other browsers, so some clicks are lost in th ether (because they trigger dblclick). I fixed (hacked) this problem by repeating the same handler code for dblclick as for click if browser is IE ($.browser.msie). It's an hack, not a good solution. If someone knows how to fix this properly please let me know.