<comment-box network="hackernews reddit" items="11850599 11850500 11859454"></comment-box>
For the Edit: I searched this thorough, custom elements cannot be self-closing. And the closest thing that I found indicates that, even if they could be self-closing (void elements), then they cannot have anything inside (which is also not what I wanted).See example:
Sure, but attribute (or tag) names refer the the structure of the document whereas values refer to each special case; structurally (essentially) those two are the same:
<comment-box hackernews="1">
<comment-box reddit="4">
but you can't tell because they have different attributes.Okay, so in order to write (current solution):
<comment-box hackernews="11850599" reddit="11850500 11859454"></comment-box>
you could do: <comment-box network="hackernews" items="11850599"></comment-box>
<comment-box network="reddit" items="11850500 11859454"></comment-box>
which would work just the same, you just have to group consecutive comment-box into one; or you could even do this: <comment-box sources="hackernews: 11850599; reddit: 11850500 11859454"></comment-box>
(inline css style). <comment-box>
<source name="hackernews" items="12"/>
<source name="reddit" items="24 27"/>
</comment-box>
which would be very readable; but since we don't have self-closing tags and we need to use hyphens in tag names, it's probably defensible to try to limit the number of tags and put as much information as possible inside attributes...I think that's the same as with the modern <picture> and <video>. I recently tried something similar but in "traditional" html structure, but also found it a bit too verbose for my taste:
https://medium.com/@fpresencia/leveraging-modern-apis-a13fa6...
...if the element is one of the void elements,
or if the element is a foreign element, then
there may be a single U+002F SOLIDUS
character (/). This character has no effect
on void elements, but on foreign elements
it marks the start tag as self-closing.
The list of element types [2] is fairly short, so I think if you attempted to self-close a custom tag, behavior might depend on how the parser's error recovery treats custom elements.[1] http://w3c.github.io/html/syntax.html#start-tags
[2] http://w3c.github.io/html/syntax.html#writing-html-documents...
(Why would HTML5 have both self-closing and non-self closing tags though?? It's just a syntax shortcut, they should either take it or leave it, but create a special class of "empty tags" seems crazy to me).
It's obviously not very important... I can't seem to be able to put into words why it bothers me so much! ;-)
Minor gripe: not sure if it's a good idea that the network be an attribute name instead of an attribute value; to this:
I would prefer: If you have a different attribute name per network, the DTD changes every time you add a network. Not that anyone cares, but still.- - -
Edit: a previous version of this comment asked why the tag was not self-closing; in fact, custom elements in HTML5 should indeed have a closing tag; see
http://stackoverflow.com/questions/23961178/do-custom-elemen...