<html> <head><title>I ❤️ JS</title></head> <body><script src="/init.js"></script></body> </html>
Is HTML a vestigial reminder of our past or are there reasons to keep it around?
- Complete: and has the building blocks for web?
- Needs to be replaced! (I ❤️ JS)
Custom Elements fixes that
<button onclick="myFunction()">Click me</button>
To answer that question, it’s important to recognize that HTML already handles more complexity than UI markup. Consider the
<button> example above, is capturing a user interaction and firing an event not complex? What about a
Polymer and Web Components served their purpose. Polymer started as a polyfil implementation of Web Components, pioneered a use case, and then slowly disappeared. The great ideas of Polymer and Web Compoents were moved into browser native support, like how
<video> are nativily supported. The less useful features such as HTML Imports and 2-way data binding were removed from Polymer. What remained were snippets of helper utilities not applicable to all scenarios, so it made sense to repackage them as Lit library.
At this time, all browsers support the extension of HTML using
There will always be a use for frameworks even in a world with custom elements. But where and when to apply them might change a little. Internally a custom element can be massivily complex application benefiting from the use of framework. Maybe a different framework maps better to the concerns of page scope than inside a custom elements. It is also in everyones best interest to have the freedom to mix components from different sources, it should be possible to drop in a React or Angular component into a Vue app without being an expert in how the component was implemented.
HTML is Complete and has the Building Blocks for Web
HTML has all the necessary primatives, most people just need templates
What if HTML had all of the primatives necessary? Obviously people need more than a
<div> and some CSS to make an app. But what if a
<custom-elements> existed for everything you needed to code?
User-friendly editors like Wordpress, Shopify, or Wix have created succesful websites by abstracting complexity away - comment sections are drag and drop integrations to Disqus, Discourse and Facebook. Simplicity should also be maintained down to code level, it shouldn’t matter if programming is done in a UI or directly in the Liquid templates there isn’t a reason that same comment section needs to be something to worry about.
HTML needs to be replaced
According to the 2021 StackOverflow Survey:
“50% indicating they have been coding for less than a decade, and more than 35% having less than five years in the trade”
“60% of respondents learned how to code from online resources”