Google Groups

Re: document ready event?


Erik Arvidsson Nov 6, 2009 10:31 AM
Posted in group: Closure Library Discuss
This is intentional. We should post an article about it.

The short story is that we don't want to wait for DOMContentReady (or worse the load event) since it leads to bad user experience. The UI is not responsive until all the DOM has been loaded from the network. So the preferred way is to use inline scripts as soon as possible. 

<div id="my-widget"></div>
<script>
initWidget(document.getElementById('my-widget'));
</script>

Yes, it not as easy to maintain but it leads to a better user experience.

By intentionally leaving out DOMContentReady wrappers we have been able to prevent Google Apps to use on this anti pattern.


On Thu, Nov 5, 2009 at 23:06, TonyWang <hsie...@gmail.com> wrote:

I just can find LOAD event in goog.events.EventType.LOAD

is there any event listener like jquery's $().ready() ?

thanks for all



--
erik