bcardarella/client_side_validations — Issue #226: client_side_validations uses asynchronous callbacks
Author: morganchristiansson
Created: 2011-11-22 22:57:22+00:00
State: open

From the jQuery documentation:
http://api.jquery.com/jQuery.ajax/

Note that synchronous requests may temporarily lock the browser, disabling any actions while the request is active.

Here's an article microsoft wrote about it:
http://blogs.msdn.com/b/wer/archive/2011/08/03/why-you-should-use-xmlhttprequest-asynchronously.aspx

8.4% of all hangs in IE9 in the past month are caused by XMLHttpRequest objects blocking the UI thread with a synchronous request. That’s a huge number! With some manageable code changes, these hangs can be avoided, and developers can give their users a better experience across their websites.

Which inspired a discussion on reddit about synchronous requests: http://www.reddit.com/r/programming/comments/j89cj/84_of_all_hangs_in_ie9_in_the_past_month_caused/

It's noticeable when using as the browser momentarily freezes while typing, it also looses keypresses when i try to tab between the text fields quickly.

I started a refactoring to address this in my fork, please have a look and see what you think.

It's very much a work in progress. I haven't finished the logic in validateElement() yet, all validator tests need to be refactored to use callbacks so there's 64 test failures. I thought I'd ask your opinion on it first before doing this.

Maybe there's an easier way, the remote callback could be called differently as there's only 1 instead of refactoring all local validators to use callbacks. But this obviously breaks the .all() function.

https://github.com/morganchristiansson/client_side_validations/commit/19f72eeffda7ff242d3301ae265a8c40dabd4a60#diff-1

I'm gonna spend a bit more time on it I'll update this ticket in a bit.