Html: Feature request: to complement a <noscript> a <yesscript> to assist progressive enhancement

Created on 31 Oct 2020  路  3Comments  路  Source: whatwg/html

To complement <noscript> I suggest <yesscript> to indicate any DOM states before JS is executed.

A way of thinking about the modern web is that there are basically two target browser categories: JS disabled browsers which includes browsers that don't support JS... and JS enabled browsers.

JS disabled browsers do render <noscript> to show equivalent content. So web developers can effectively target JS disabled browsers in server HTML, while progressively enhancing the page for JS enabled browsers.

However there is no equivalent feature in server rendered HTML for JS enabled browsers. There is no way of showing "Loading..." in server HTML to JS enabled browsers in the seconds before JS executes without also permanently displaying "Loading..." to JS disabled browsers.

I suggest that the two factors of (1) the modern reliance on JS, and (2) the support of <noscript> without an equivalent <yesscript> feature; encourages most web developers to favour market forces and not user preference, which has the 'perverse incentive' of encouraging server-rendered HTML that includes content only for JS enabled browsers. E.g. content like "Loading..." screens.

I suggest that HTML include a <yesscript> that only JS enabled browsers display so that web developers can render content for the majority of JS enabled browsers in the seconds before JS is executed, to allow web developers to cater for both scenarios.

Web developers might use <yesscript> to render placeholders or UI features available only in JS enabled browsers.

additioproposal needs implementer interest

Most helpful comment

Can't you just do this?

<noscript>
<style> yes-script { display:none; } </style>
content 1
</noscript>
<yes-script>
content 2
</yes-script>

All 3 comments

Can you show an example where the script would not have executed before rendering has happened? That seems somewhat unlikely.

Can't you just do this?

<noscript>
<style> yes-script { display:none; } </style>
content 1
</noscript>
<yes-script>
content 2
</yes-script>

As long as nothing overrides that and you don't use any ID's in the <yes-script>. Not sure if there's any other cases where it's different.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

NE-SmallTown picture NE-SmallTown  路  4Comments

petamoriken picture petamoriken  路  3Comments

lazarljubenovic picture lazarljubenovic  路  4Comments

mustaqahmed picture mustaqahmed  路  4Comments

iane87 picture iane87  路  3Comments