Re:Show HN: Embed HN comments in your website
by bambax on Tuesday November 08, 2016 @12:13PM
(#12901993)
> on my end it wouldn't make any difference at all
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).
Re:Show HN: Embed HN comments in your website
by bambax on Tuesday November 08, 2016 @12:23PM
(#12902088)
The last example of my previous comment is a little ugly; in "real" XML we would write:
<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...
Re:Show HN: Embed HN comments in your website
by franciscop on Tuesday November 08, 2016 @12:52PM
(#12902367)
Totally agree about your conclusion (:
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...
See example:
https://jsfiddle.net/franciscop/eo5v6ghc/