A partial archive of discourse.wicg.io as of Saturday February 24, 2024.

Undefined command reserved?

Nick_Levinson
2017-09-24

Is there a reserved word or other string that can be formatted like a command using HTML-like formatting (<. . . /> and <. . .> and </. . .>) and that can have zero or more attributes with or without values but that will have no meaning to a user agent, won’t fail validation, won’t be deleted by default by minification, and won’t become an HTML command in the future?

If today’s HTML was all I had to worry about, I could invent one, since HTML says that if a command is not recognized a user agent is to ignore it and move past it. However, I’m finding snippets in other languages embedded in HTML pages because parsers (such as Google’s or Facebook’s) are looking for them, and a string that is unrecognized in HTML may be meaningful in another language found in Web page source code. Plus, an unreserved word may turn up in a future development of HTML or another language, creating a conflict with then-pre-existing usage as meaningless. Thus, inventing a string may well backfire with unpredictable results.

Comments tend to get deleted by minifiers.

Therefore, I hope a specification reserves a meaningless string for arbitrary use.

An analogy is to the specification reserving example.com as a domain anyone may use in documentation or *.test as a top-level domain (TLD) for certain uses. These get used. I’d like this HTML-like string for organizing source code, but other use cases are possible.

If there isn’t such a string, maybe I’ll suggest an enhancement to HTML (5.1 or Living Standard) or write a spec, in which case I’d like proposals for a string.

Thank you.

jhpratt
2017-09-24

Custom elements

Basically any element with a dash in it will never be implemented, and there’s a JS interface to let you do what you want.