How make your web-app become available faster: Let go of the DOM Ready events
1–10 of 20 posts
Re: How make your web-app become available faster: Let go of the DOM Ready events
#2Re: How make your web-app become available faster: Let go of the DOM Ready events
#3Consider'd: http://javascriptisawesome.blogspot.com/2011/07/faster-than-... ?
It should be noted that the event used in that, DOMNodeInserted, is deprecated: http://www.w3.org/TR/DOM-Level-3-Events/#event-type-DOMNodeI...
Re: How make your web-app become available faster: Let go of the DOM Ready events
#4Re: How make your web-app become available faster: Let go of the DOM Ready events
#5worth reading in relation to this, including the impact of the CSSOM http://calendar.perfplanet.com/2012/deciphering-the-critical... and using the DOMContentLoaded event
Re: How make your web-app become available faster: Let go of the DOM Ready events
#6This would require some discipline in a shop using this. For one thing, one would want to have a convention where write() is not used or perhaps is disabled until the operation is safe. Also, this may be a form of optimization which is applied based on profiling. An app would benefit most from this on the pages most frequently viewed the earliest. ROI would increase for mature code which is changing less frequently.
Re: How make your web-app become available faster: Let go of the DOM Ready events
#7So as a summary, Javascript loaded (except for loaded via document.write) can immediately access the DOM if the Javascript is loaded in the bottom of the body-element making the use of a ready-event like jQuery's ready-event obsolete.
I have always wondered if that really is the case but haven't tried it out myself, seems that it's a green light then. :-)
Re: How make your web-app become available faster: Let go of the DOM Ready events
#8Like dynamic web apps aren't already flakey enough.
Re: How make your web-app become available faster: Let go of the DOM Ready events
#9An important caveat to the "load scripts at the end of the document technique": The visual elements of a page will render before the functional components (i.e., JavaScript) are available.
Imagine a site the sets a custom `submit` handler for a `` tag, possibly for client-side form validation, an AJAX file uploader, date selection, etc. A user submits the form before JavaScript has loaded completely and doesn't get the benefit of the JavaScript-enhanced experience. In local development or on a high-speed connection this will probably never happen. But a user accessing the site with their phone over the slow U.S. cell data network has a much higher chance of hitting upon this undesired behavior.
Re: How make your web-app become available faster: Let go of the DOM Ready events
#10Let go of JavaScript.