Live data from Hacker News

Stop Paying Your jQuery Tax

samsaffron.com

41–50 of 90 posts

Re: Stop Paying Your jQuery Tax

#41
I think they're still missing the point. The idea is to stop using jQuery like that. Think of it as another required module of your application and move everything to requireJS. You'll gain speed and peace of mind once you learn to modularize all your JavaScript code.

Re: Stop Paying Your jQuery Tax

#42
post #21

Why do you still need a document ready function if all your scripts are loading after the html anyway?

The DOM will have been parsed if your scripts are at the end—but external components (links, imgs) may not have loaded yet.

The same is true whether or not you use a document.ready statement; you're thinking of window.onready, which fires once all images have been downloaded.

Re: Stop Paying Your jQuery Tax

#43
post #37

Please go check out StackOverflow's source code before bandwagoning on this topic. This is shifting blame to the tools. The problem lies on StackOverflow's lacking design and not in jQuery. Pushing jQuery to the bottom of the page is trivial if you do proper HTML architecture. Pages should have only HTML. JS files only JS. JS files referenced at the very bottom of the body. Very simple. (if your asp/c#/* framework do…

Agree, I use Django and I had no idea what they were talking about. They should check out other frameworks before writing posts with generic headlines.

Re: Stop Paying Your jQuery Tax

#44
post #42

Earlier quoted context omitted.

The DOM will have been parsed if your scripts are at the end—but external components (links, imgs) may not have loaded yet.

The same is true whether or not you use a document.ready statement; you're thinking of window.onready, which fires once all images have been downloaded.

You are correct! Thanks. Been spending too long with document.readyState.

Re: Stop Paying Your jQuery Tax

#45
post #37

Please go check out StackOverflow's source code before bandwagoning on this topic. This is shifting blame to the tools. The problem lies on StackOverflow's lacking design and not in jQuery. Pushing jQuery to the bottom of the page is trivial if you do proper HTML architecture. Pages should have only HTML. JS files only JS. JS files referenced at the very bottom of the body. Very simple. (if your asp/c#/* framework do…

Let's be clear ... I am not attacking jQuery here, just saying it is misuse to chuck it in the header and offering a practical mechanism to get out of a mess you create. I explain the cost of placing it in the header. I am not perfect, I make mistakes daily, I try to learn.

Re: Stop Paying Your jQuery Tax

#46
post #37

Please go check out StackOverflow's source code before bandwagoning on this topic. This is shifting blame to the tools. The problem lies on StackOverflow's lacking design and not in jQuery. Pushing jQuery to the bottom of the page is trivial if you do proper HTML architecture. Pages should have only HTML. JS files only JS. JS files referenced at the very bottom of the body. Very simple. (if your asp/c#/* framework do…

[deleted]

Re: Stop Paying Your jQuery Tax

#48
post #45
post #37

Please go check out StackOverflow's source code before bandwagoning on this topic. This is shifting blame to the tools. The problem lies on StackOverflow's lacking design and not in jQuery. Pushing jQuery to the bottom of the page is trivial if you do proper HTML architecture. Pages should have only HTML. JS files only JS. JS files referenced at the very bottom of the body. Very simple. (if your asp/c#/* framework do…

Let's be clear ... I am not attacking jQuery here, just saying it is misuse to chuck it in the header and offering a practical mechanism to get out of a mess you create. I explain the cost of placing it in the header. I am not perfect, I make mistakes daily, I try to learn.

You pointed out a few best-practices, but it's a shame that this article is written in the context of jQuery, rather than recognizing that these "taxes" are true with every script tag you place on your website.

Re: Stop Paying Your jQuery Tax

#49
post #48
post #45

Earlier quoted context omitted.

Let's be clear ... I am not attacking jQuery here, just saying it is misuse to chuck it in the header and offering a practical mechanism to get out of a mess you create. I explain the cost of placing it in the header. I am not perfect, I make mistakes daily, I try to learn.

You pointed out a few best-practices, but it's a shame that this article is written in the context of jQuery, rather than recognizing that these "taxes" are true with every script tag you place on your website.

That is absolutely true, was looking at the cnn.com .. http://z.cdn.turner.com/cnn/tmpl_asset/static/intl_homepage/... which is in the header chews up 100k of compressed js. This monster must take upwards of 20ms to parse in chrome as well. Way worse in crappy browsers, the CDN network you need to support this is huge.

Re: Stop Paying Your jQuery Tax

#50
post #49
post #48

Earlier quoted context omitted.

You pointed out a few best-practices, but it's a shame that this article is written in the context of jQuery, rather than recognizing that these "taxes" are true with every script tag you place on your website.

That is absolutely true, was looking at the cnn.com .. http://z.cdn.turner.com/cnn/tmpl_asset/static/intl_homepage/... which is in the header chews up 100k of compressed js. This monster must take upwards of 20ms to parse in chrome as well. Way worse in crappy browsers, the CDN network you need to support this is huge.

Where are you getting these numbers from?
Post reply on HN