mozumder / HTML6

An HTML6 proposal for single-page apps without Javascript.
85 stars 7 forks source link

Be careful with HTML global attributes "lang" and "class" #5

Closed prlbr closed 9 years ago

prlbr commented 9 years ago

Currently, the attribute "lang" is used on the "fixture" element with an example value of "json". This is wrong, because "lang" is a global attribute in HTML whose value must be a BCP 47 language tag. BCP 47 "excludes languages not intended primarily for human communication, such as programming languages" (quoted from BCP 47). Another attribute name should be chosen.

The attribute "class", currently used on the "model" element, is also a global attribute in HTML. Please check whether this causes conflicts with its intended use here as well.

https://html.spec.whatwg.org/multipage/dom.html#the-lang-and-xml:lang-attributes http://www.ietf.org/rfc/bcp/bcp47.txt https://html.spec.whatwg.org/multipage/dom.html#classes

mozumder commented 9 years ago

Ah yes thank you. Will change LANG to TYPE. Not sure why I typed in LANG (wanted it to be equivalent to <SCRIPT type="text/javascript">)

As for class, I agree it should be changed. I wanted it to be an equivalent to an TABLE, will pick something besides class.

AndySky21 commented 9 years ago

I would also suggest to use some caution with "type" attribute. Though not global, it is usually associated with MIME types, such as on <script>, <object> etc. It is a matter of language consistency.

mozumder commented 9 years ago

Changed the <FIXTURES TYPE> parameter to be "application/json" to be MIME compliant.

And changed the <MODEL CLASS> attribute to <MODEL NAME>

AndySky21 commented 9 years ago

You still use <main@class=viewer> and <menu@class=controller> at the end of Example 1. There's nothing bad in this case, as class can somehow suggest the element's function. Just note that @class is not an enumerated attribute (i.e. you yourself should list the values you are interested in) and pay attention that those values are not used in other elements/contexts, neither initially nor by browser extensions and so on. Or you could use a brand-new element for every purpose:

Also note that <article class="sidebar"> makes really poor syntax, as it would be better rendered by <aside> element IMHO.

prlbr commented 9 years ago

Andrea, I think the classes in the "main" and "menu" elements don't have any special meaning in the example. I suppose they were just included as explanation and could be used for styling purposes for example. But they could be left away, too. They are not significant. That's why I already closed this issue. But it can be re-opened if I'm missing something here.