3 ms·
It’s frustrating to me that we don’t have more directives. I’m simply spitballing however, here’s some examples: We have <!doctype html> but why not add other
by no_wizard 1y ago
It’s frustrating to me that we don’t have more directives. I’m simply spitballing however, here’s some examples:
We have <!doctype html> but why not add other doc types as time goes on? Instead of shoehorning features you could have a <!doctype new-html> which would opt a web page into the ability to use newer features like newer elements or cleaner APIs
There is also the “use strict” directive in JS (which any script tag with type=“module” runs in now, slowly eliminating this need) that would opt your script into a stricter form of JS. You could even do it on a per function basis. We could have something like that for other features or stricter qualifiers etc.
We have done this before successfully and broadly, I think it’s time we revisit the usefulness of doing this again
- bawolff 1y agoBut umm, why would you want that? Javascript has "use strict" to disable the parts that fundamentally cause problems even if you don't use them. What exactly is in html you want to disable here? There are features that maybe dont make sense but they are largely self-contained. Unlike in js you can simply not use them and its fine.
- TOGoS 1y ago> We have <!doctype html> but why not add other doc types as time goes on We do have older ones! <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> and <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> Unfortunately the "be liberal in what you accept" principle, in combination with general incompetence and anti-competitive practices by certain browser vendors, meant that all the browsers kind of ignored it and treated everything as quasi-structured tag soup regardless of the doctype, which is why WHATWG tried to codify what the browsers were already doing and decided we should all just <!doctype html>. Have we collectively learned the lesson? If so maybe we could have a new doctype for [X]HTML 6. I won't be holding my breath for it.