Ticket #6185 (closed enhancement: wontfix)
ready( fn ) should not be synchronous
|Reported by:||hallettj||Owned by:|
I am sure this has been discussed before; but I was not able to find such a discussion.
Because that event registration takes places after the other class is initialized my code ends up missing the event. If ready( fn ) were called asynchronously in every case this would not be a problem.
I will cite the principle of least surprise to make the argument that ready( fn ) should behave as consistently as possible - that is it should invoke its callback asynchronously under all circumstances. Because it does not I 1) was surprised and 2) had to wrap a setTimout() around my event-triggering callback to handle the special case where an instance is initialized after the document is ready.
My proposed change is attached as a patch.