Live data from Hacker News

Rethinking DOM from first principles

acko.net

11–20 of 234 posts

Re: Rethinking DOM from first principles

#11
post #8

Good article. It kind of makes me question how long we can go down this path though. Like surely we can't keep adding to css and the dom api's for 20 more years? How much bloat will we accumulate before we start over? I hate to say it, but perhaps the browser needs a completely new standard designed for shipping applications? Something akin to what's discussed in the article - a simple but robust layout system built…

I don't know exact what system you have in mind, but writing a performant shader is hard. Requiring that designers attach arbitrary shader code to HTML elements is an easy way to absolutely tank the performance of the web. Flexbox also isn't great at all for many, many use cases - its performance absolutely tanks outside of the use case it was designed for, specifically a 1D flow of blocks along an axis. If you want…

I wouldn't expect devs to be writing their own shaders all the time - the browser could have standard shaders, and no doubt libraries would crop up that offer more.

Re: Rethinking DOM from first principles

#12
post #7

Earlier quoted context omitted.

This view is completely backwards and I'm baffled by its popularity. Given that even newspaper websites are now built as applications, we should accept that the web is an application platform (with one of those applications being displaying articles) and rework HTML as an application display language. And we need to start relying on JS more. (Specifically, we should reimplement most traditional HTML elements and CSS…

That's because you're looking at it from the perspective of what the developers of those news websites want, rather than what the users of those news websites want. The users want to get a document , not an app. That's what the web was made for, documents.

The users want to read an article, I'm not sure the average user really cares if it's delivered as a document or an app

Re: Rethinking DOM from first principles

#13
post #7

What needs to happen is that HTML needs to go back to being a mark-up language, and the web needs to stop trying to deliver an application-level implementation for every single website. And we need to stop relying on JS so much.

This view is completely backwards and I'm baffled by its popularity. Given that even newspaper websites are now built as applications, we should accept that the web is an application platform (with one of those applications being displaying articles) and rework HTML as an application display language. And we need to start relying on JS more. (Specifically, we should reimplement most traditional HTML elements and CSS…

Many websites have no business being a full-blown application.

The web is getting smaller and smaller, being dominated by the bigger players (Google, Microsoft, Apple, et. al) for whom pushing opaque web standards and "applications" benefit only them as gatekeepers.

While it's still entirely possible for people to still build websites, search engines like Google don't prioritize them - leading them to never being discovered. 90% of the web is still the 'small' web and we can't ever discover them because they're not being indexed by Google (why should they? Most of them don't include Google's tracking js scripts ['analytics']).

The web was never supposed to be like this. It's turned into a massive surveillance engine for the big corporations.

I'll leave this here: https://wiby.me

Re: Rethinking DOM from first principles

#14

What needs to happen is that HTML needs to go back to being a mark-up language, and the web needs to stop trying to deliver an application-level implementation for every single website. And we need to stop relying on JS so much.

I agree.

I remember the older days (2005-8) when we would dump a load of HTML from the server-side and kept javascript (for the most part) managing the layout and, not to mention, coding the painful differences between browsers.. even IE6 to IE7.

As Javascript (likely thanks to jQuery for starters) got better with AJAX and supporting different browsers with less code, it seems Javascript transitioned to be a owner of data with events and triggers. As for the serverside, transitioned away from returning HTML but XML or the common Json data.

Away from jQuery (or alongside it) we ended up with Javascript frameworks leading to bindings or automated refresh of data with template views, etc. Things like mustache.js to knockoutjs to angularjs.

Now - its React, with node package managers, even grunt... to name a few... appear to be needed tools for web development these days. Its like we are just HIDING web development to an application. Underneath it all still remains the basics of HTML, CSS, Javascript -- and its relationship with the serverside language.

I will admit. In the early days of HTML development.. I hated it! Its not the HTML side of things, but the tools I had to use like Classic ASP or supporting different browsers. If we do web development today like its 2005... with modern programming languages and web browsers, "old school" web development is a joy.

In the last few years, I jumped back to the serverside generating the HTML again. I can still do "simple page" applications with AJAX returning a portion of HTML, etc.

When I explain this reasoning with other developers, I get a confused look on their face. I try to explain to them that the backend code has not changed. Its just an extra layer of returning the data back as HTML, rather than Json. It sounds like more but all it does it organise your HTML templates on the serverside, rather than just having it all done on the clientside.

Since then I have added htmx to the mix, which IMO compliments this original approach. I have made successful projects with it though I dont think I have won the co-workers. I dont think its because its the old school way or htmx -- its just they are so accustomed to the modern approach of web development.

Re: Rethinking DOM from first principles

#15
It is clear that we need both apps and documents in web browsers. Yes yes "web", "hateoas" and all that, but it didn't materalise in practice and is therefore irrelevant.

So maybe we can have , which lets you use a new set of APIs focussed on applications, but is otherwise in the same "shape". JSX type syntax.

This way it's easy for say newspapers to offer both an app format as well as a "lite" document format. Instead of their current offering which is a app shoehorned into a document and then a messy lite version.

Users who use noscript can, instead of blocking scripts wholesale and then whitelisting the good ones, request by default the lite document format. i.e .

Re: Rethinking DOM from first principles

#17
Uggghhh, the article states correct facts about the DOM but grossly incorrect conclusions. Most developers have always feared working with the DOM. This irrationality is not new. I have no idea why, but tree models scare the shit out of college educated developers. That’s supremely weird because computer science education spends so much energy on data structures and tree models.

It also makes the conversation about WASM even more bizarre. Most college educated developers are scared of the DOM. Yes, it’s fear the emotion and it’s completely irrational. Trust me on this as I have watched it as a prior full time JS dev for over 15 years. Developers are continuously trying to hide from the thing with layers of unnecessary abstractions and often don’t know why because they have invested so much energy in masking their irrational nonsense.

Other developers that have not embraced this nightmare of emotions just simply wish WASM would replace JS so they don’t have touch any of this. This is problematic because you don’t need anything to do with JS or the DOM to deploy WASM, but it’s a sandbox that ignores the containing web page, which is absolutely not a replacement. For WASM to become a replacement it would have to gain full DOM access to the containing page. Browser makers have refused to do that for clear security reasons.

So you get people investing their entire careers trying to hide from the DOM with unnecessary abstractions and then other developers that want bypass the nonsense by embracing that thing they don’t know they are yet afraid of it.

That is super fucking weird, but it makes for fun stories to nondevelopers that wonder why software is the way it is.

Re: Rethinking DOM from first principles

#18
post #12

Earlier quoted context omitted.

That's because you're looking at it from the perspective of what the developers of those news websites want, rather than what the users of those news websites want. The users want to get a document , not an app. That's what the web was made for, documents.

The users want to read an article, I'm not sure the average user really cares if it's delivered as a document or an app

Users do want to find the article via a search engine, and the search engine does prefer the article to be a document, rather than an app.

Re: Rethinking DOM from first principles

#19
post #7

Earlier quoted context omitted.

This view is completely backwards and I'm baffled by its popularity. Given that even newspaper websites are now built as applications, we should accept that the web is an application platform (with one of those applications being displaying articles) and rework HTML as an application display language. And we need to start relying on JS more. (Specifically, we should reimplement most traditional HTML elements and CSS…

I get this viewpoint from a software architecture level, but that is also effectively the death of the open web. When every website is an opaque app, even often requiring a client-side optimizing compiler that builds an arbitrary binary in order to load (WASM), we can say goodbye to things like search engines and typically also hyperlinks. The rise of social media has already balkanized the web a lot, where almost al…

Search engines already run JavaScript to understand the pages they're indexing. Android apps manage to deep-link into each other effectively despite being applications. Designing tools and standards that work well with what we have is far better than trying to hold back the tide.

Re: Rethinking DOM from first principles

#20

Uggghhh, the article states correct facts about the DOM but grossly incorrect conclusions. Most developers have always feared working with the DOM. This irrationality is not new. I have no idea why, but tree models scare the shit out of college educated developers. That’s supremely weird because computer science education spends so much energy on data structures and tree models. It also makes the conversation about W…

> Browser makers have refused to do that for clear security reasons.

Because only javascript should be allowed to screw up that badly.

Post reply on HN