DEV Community

Discussion on: Rethinking the Modern Web

Collapse
 
nielsabildgaard profile image
Niels Abildgaard

Re: Frameworks: Yeah---the note on Svelte is perhaps a bit pedantic in the big picture. I agree with your overall thoughts, and I don't mean to detract from them! I'm sure something even better than Svelte will come along (but I think we're a good ways away from standards so good we don't need frameworks)!


Re: HTML Imports: Agreed - a fully native import in HTML would be really cool. I'll point again to .webc as a format that could have relevance, by leaning into the (already established) Web Component syntax. Imagine <my-component src="/my-component.webc"></my-component> or somethink like this, off the top of my head:

<link rel="component" name="my-component" href="/my-component.webc">
<!-- ... -->
<my-component>
  <h1>This is placed inside the component.</h1>
  <p>.webc supports slots, too.</p>
</my-component>
Enter fullscreen mode Exit fullscreen mode

Re: Javascript and the DOM: I think the two are so intertwined that it is nonsensical to consider them as separate in any way :-) The DOM is designed to be manipulated by Javascript. Javascript is designed to manipulate the DOM.

Thread Thread
 
oxharris profile image
Oxford Harrison

Really great thoughts you've shared in all. I fully embrace them. And we might even have more to converse on in my next piece in this series. Looking forward to that. (I'd love to bring the .webc idea up in that article where we can play with it alongside other ideas.)

Regarding JavaScript and the DOM, this MDN reference might be what I really have in mind. TL;DR: these two things just happen to meet each other in the browser (and browser-like environments), whereas they're really independent standards. You can expect to see DOM implementations in other languages like Java, and you can even more so find JavaScript runtimes that have no idea of the DOM. E.g. node.js

Thread Thread
 
nielsabildgaard profile image
Niels Abildgaard • Edited

I look forward to reading your next piece :-)

I understand your view on Javascript, and I agree that it has uses where the DOM is not present. And that the standards for the two are separate.

The context of my original comment was this sentence, which seems to imply not just different standards, but a lack of coupling between the DOM and Javascript:

And notice how this comes even at the risk of tight-coupling a supposed general-purpose, DOM-agnostic programming language with the DOM!

To zoom out a bit, this sentence comes in the context of critique of HTML modules, e.g. import htmlData from '/someFile.html';. I don't think supporting common formats for imports really ties Javascript any closer to "the web" or "the DOM" than e.g. support for importing JSON files does.

(JSON is not the same as Javascript objects---and you could just write your files as Javascript files if you wanted a more clean/less tightly-coupled to web technologies approach to Javascript.)

I would also welcome import of e.g. XML data in a standardized way, and across environments (web, Node.js, deno).

Perhaps I am just reading too much into "DOM-agnostic", or the idea that Javascript isn't already (in design terms) quite tightly coupled to the design of the DOM. It would be incredibly hard to change one without consideration for the other, c.f. backwards compatibility to 1995 (for both the language and the DOM classes), having co-evolved with the web platform, etc.

Thread Thread
 
efpage profile image
Eckehard

The Chrome rendering engine and the Javascript V8 engine are both written in C++, so I suppose there is no "natural" connection between the two. But the HTML-DOM-API opens the DOM for any kind of manipulation, including creation of the whole DOM tree. So I suppose, the API is mainly an interface to the rendering core.

So, if we build websites mainly with Javascript, using Javascript to create HTML to let the rendering engine create the DOM might possibly not be the most clever thing we can do. In any case it is not the fastest...

Thread Thread
 
nielsabildgaard profile image
Niels Abildgaard

As an example of this, when Flutter builds for web, it renders everything in a canvas - no DOM.

It has a lot of other downsides. HTML/the DOM is a really good model for supporting accessibility needs, for example.