views:

103

answers:

4

Fast clicking on IE has slower response than firefox, chrome and safari. Why? (I'm using jquery)

A: 

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).

manyxcxi
+6  A: 

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>
Josh Townzen
+4  A: 

WebKit's SunSpider test (which covers a wide selection of pure-JavaScript functionality). Here is the break down:

JavaScript Performance Rundown

as you can see, IE is slow on javascript.

source and more here.

Reigel
+1  A: 

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.

Alexandre Gomes