Best practice for initializing widgets?

Best practice for initializing widgets?

What is the best practice for initializing widgets? In the demos, the document.ready event is used, but wouldn't it be better to use inline script blocks directly after the corresponding html structure? If you have a large page or a slow connection, and you use the document.ready event, you will see the basic html structure (e.g. ul-li for tabs) until the whole document is loaded. Instead, placing a script block directly after the required html structure would immediately initialize the widget. Is there a known drawback to using an inline script block, or is this considered this a valid alternative? I would imagine that dialogs and the datepicker will cause problems, as they create some parts of their UI at the end of the document, which would then not be ready. Any recommendations?