w3c / clreq

Requirements for Chinese Text Layout
https://www.w3.org/International/clreq/
Other
728 stars 61 forks source link

What is the purpose of the `class` attribute of the `script` tag in `index.html`? #462

Closed kecrily closed 2 years ago

kecrily commented 2 years ago

I found that the script tag in index.html uses the class attribute.

https://github.com/w3c/clreq/blob/58376bca9a35a5e069a7b704d46b27e2f8ed085c/index.html#L9

I didn't know that script had this attribute and thought it was some kind of feature, so I looked up MDN.

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/script

But I couldn't find it in the MDN, so what is its purpose?

r12a commented 2 years ago

The Respec content management code uses this script to generate the page, then removes the no longer needed javascript from the final rendered document.

kecrily commented 2 years ago

So the class attribute is a description of the purpose of this script? Right?

r12a commented 2 years ago

The class attribute is being used to indicate to the CMS that it should remove the not-needed script code from the rendered page. So not so much a description of the purpose of the script, but a description of what to do with the script.

kecrily commented 2 years ago

I got it! Thanks r12a

xfq commented 2 years ago

See https://github.com/w3c/respec/wiki/remove for details.