re: A JavaScript-Free Frontend VIEW POST

VIEW FULL DISCUSSION
 

Javascript can be blamed of a lot of unfortunate consequences, but we should not forget what it offers. If you were building a picture gallery, you would love to perform lazy loading. With a server-side rendered only web page, you would not be able to offer such a fast experience. Actually, a service workers of about 100 line of code can outperform any server caching by offering graceful cache control (stale while revalidating, cache first for images,...), and the benefit for the user bandwith is largely worth the cost of JS.

However, I completely agree with you, there is a Javascript fatigue right now. Frameworks ship too much dependencies, web page weight more and more with unused bytes of piece of code. This is also why some big companies put a Javascript budget (a certain amount of Kb to not overpass for example). Some alternative like Preact or Hyperapp fit very well those project constraints while providing a correct development experience.

 

Yeah totally! I'm disappointed that so many features we expect from a modern web experience, like lazy loading, require JavaScript. I was hoping this would spur some discussion about some rethinking of HTML that might alleviate that.

For example, wouldn't it be amazing if such a thing as <img src="..." lazy="500px"> were possible such that the browser would load the image if its bounds were visible in the viewport or within 500px of the scroll position?

 

I cannot find where it is written, I might have saw it in one of their video: the Chrome team is working (I think it was a talk with Addy Osmani in which I heard this, correct me if I am wrong) is actually working/thinking of a lazy="true" attribute on img video and audio to help make this a de facto feature on the web. So maybe they heard your request 😉

It's changed a little since then but yes there is a built in lazyload in the pipeline 😀

load="lazy|eager|auto"

 

I don't think adding even more functionality to HTML is obviously. It makes it harder to implement browser engines. The added complexity makes it harder to implement browsers reliably too.

Also have a look at Alan Kay's augments on the topic:

drdobbs.com/architecture-and-desig...

I like the point of view in the thread you shared, but I am afraid this is the reason Linux is not spreading as much as Windows for example: features. Most of the time, you will encounter développer for the sake of a project, not pure développer for the sake of the technology. Which means, people want to scale, fast, with ready-to-use state-of-the-art technologies like lazy loading. If we were following the principle stated on the article you shared, awesome advancements security features like finger print authentication, isolated websites, etc... Would have not been implemented. Nor Services Workers, or media lazy loading, that seems obvious when you think of it. I do not agree with this article, but I appreciate the point of view, it definitively have advantage to think like this, but I think this does not fit the web and web browser. We need people that can be up and running fast, not relying on npm package that got deprecated because of loss of money and energy, and having to deal with this.

code of conduct - report abuse