ftlabs / fastclick

Polyfill to remove click delays on browsers with touch UIs
MIT License
18.66k stars 3.23k forks source link

"RangeError: Maximum call stack size exceeded." running on iPad #353

Open johnnyshields opened 9 years ago

johnnyshields commented 9 years ago

Using fastclick version 1.0.3

On iPad we saw a random error "RangeError: Maximum call stack size exceeded."

Stacktrace:

[native code]:13743:23    dispatchEvent
bower_components/fastclick/lib/fastclick.js:296   sendClick
http://xxx.com/assets/vendor.js:91973:17    onTouchEnd
http://xxx.com/assets/vendor.js:91477:42

This line which triggered the error was in FastClick.prototype.sendClick function.

targetElement.dispatchEvent(clickEvent);
rowanbeentje commented 9 years ago

Hi @johnnyshields - the line which triggered the error in fastclick will be responding to user interaction, triggering the onclick action in your vendor code. If the backtrace showed lots of nested calls within fastclick, then fastclick is at fault - but if it ended up in your vendor.js, I'm inclined to think that this is just a looped function call in your code, where fastclick is just the entry point.

Does that make sense?

johnnyshields commented 9 years ago

@rowanbeentje this does make sense, we will take a second look. Thanks for the fast response!!

johnnyshields commented 9 years ago

@rowanbeentje FYI after investigating those two vendor.js lines were actually in FastClick lib as well, I guess in staging env we have two copies of it, one which is compiled into our vendor.js. This may be evidence against the "infinite-loop" theory... maybe related to https://github.com/ftlabs/fastclick/issues/262 ?