Hacker News new | past | comments | ask | show | jobs | submit login

>But if the point is that whatever comes next probably won't come out of a committee that sounds about right.

The alternative seems to be some kind of unilateral action, and I have yet to see that working for the web. The reality of the matter is that Microsoft, Mozilla, Google and Apple all need to agree on whatever happens next. That's a committee.




Good things came out of unilateral action: XmlHttpRequest, innerHTML, document.write, asm.js, WebRTC, JavaScript itself...


I wouldn't put "document.write" in there.

But also: Canvas, CSS 3D, etc.


> I wouldn't put "document.write" in there.

innerHTML isn't awesome either, but that's from today's point of view. It's good that we moved on, even though at the time it was important they existed.


this is what makes a fast browser hard to write - scripts can mess up your document

so in fact browsers kind of assume nobody is crazy enough to do document.write

and then when it gets called they redo all the work rendering the page


Obviously that train has left the station ages ago.

We now have dynamic documents were scripts are MEANT to mess with the page constantly, and even create it's contents from scratch in some cases.


No, you don't understand. What you're talking about is after the page loaded scripts execute and modify the page. That's completely fine. I'm talking about page load time. A script potentially can force you to reparse the page.

A script can insert something like </div><div class="something"> into the page in a random spot, completely wrecking the layout you just made. Adding a new div at runtime on top of the other parts of the page is easy. Something that can actually make all the positioning on the page completely change is much more evil.

So in fact, browsers usually get the HTML, parse it, get the CSS, position/style things while getting the JS (hopefully you have optimized it so the CSS loads before your scripts). Now if the JS file has document.write you have to reparse the HTML because the current tags could be a lie! The document.write could have closed a tag and opened a new tag.

Compared to that, just setting the innerHTML of a tag is much less expensive. You just need to potentially reflow its size and its parents. The rest of the page may not be affected. document.write may force you to tear everything down and start all over again




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: