News for hackers. Stuff that matters.
Re:Don't wait for "DOM ready" for your app to start by javajosh on Friday June 08, 2012 @07:29PM (#4086623)
Honestly, I don't like claims like this that are offered without any support. Why shouldn't I wait for the DOM to be ready? Am I losing performance? If so, where are the benchmarks?

Frankly, I'm surprised a casual comment on G+ is getting any traction whatsoever on HN.

Re:Don't wait for "DOM ready" for your app to start by crazygringo on Friday June 08, 2012 @11:35PM (#4087086)
In my experience, the main reason is any ad content you're serving. If an ad network's content times out (which I've seen happen for hours at a time, multiple times a year), your page might take 30 seconds until it fires the DOM ready.

At one company I worked at, the ad network we used got so bad that we not only executed all our JavaScript at the bottom of every page (instead of in the DOM ready), but also only loaded the ads after that, and then dynamicaly repositioned them to the "inline" spots where they supposed to appear.

Re:Don't wait for "DOM ready" for your app to start by pestaa on Saturday June 09, 2012 @06:39AM (#4087806)
I wonder if post-loading ads is allowed in most TOSes. If I were in their shoes, I would not like it.
Re:Don't wait for "DOM ready" for your app to start by ma2rten on Saturday June 09, 2012 @07:54AM (#4087885)
I agree, I also don't like claims that it impacts performance to unnecessarily wait for the CSS to download without any benchmarks. I also don't like it when people say that exponential time algorithms take longer than polynoinal time algorithms without showing benchmarks.
Re:Don't wait for "DOM ready" for your app to start by mattmanser on Friday June 08, 2012 @07:43PM (#4086661)
The DOM loaded event can take a while to fire, there's no need to wait for it but then you end up either sprinkling your html with script tags or firing a script just before the end body tag. i.e. maintenance nightmare for the former, what's the point for the latter? Neither much better than just waiting for dom loaded.

If it is taking a while to fire, better to solve that problem than piss around with a half built page in my experience. I experimented at one point with js enhancing controls just after they were declared, it's honestly not worth the effort. He'll learn.

This smacks of the bootstrap semi-colon nonsense, we all tried semi-colonless once, it ends up a nightmare, but some mistakes the next generation need to figure out themselves.

Re:Don't wait for "DOM ready" for your app to start by barclay on Friday June 08, 2012 @07:50PM (#4086678)
> better to solve that problem than piss around with a half built page in my experience.

Seconded. This can cause far more bugs and timing problems than it's worth. Find out what's taking so long to fire, and fix (or defer) that.

Re:Don't wait for "DOM ready" for your app to start by mkmcdonald on Friday June 08, 2012 @08:35PM (#4086779)
> [on placing a script before the end tag of the body element] what's the point [...]? Neither much better than just waiting for dom loaded.

I'll take sane, library-agnostic script without event listeners for $500, Alex.

Re:Don't wait for "DOM ready" for your app to start by kevingadd on Friday June 08, 2012 @08:31PM (#4086775)
Yeah, whether or not you can run stuff before DOM ready is often one of those questions where most answers are right 99% of the time and piss off your customers the other 1% of the time. Have fun debugging your little optimization when you literally can't reproduce the bug in your own debugging environment.
Re:Don't wait for "DOM ready" for your app to start by cheatercheater on Saturday June 09, 2012 @07:49AM (#4087877)
The supporting information was supplied with the claim. You wait for items irrelevant to your applications to (very sluggishly) load. I suggest reading the book "High performance websites", it's very thin.