by iopq · 12y ago · 0 comments
<img>
<srcset>
<source><width>1024</width><src>large-image.jpg</source>
<source><width>512</width><src>small-image.jpg</source>
</srcset>
<src>image.jpg</src> <*>fallback</*>
<alt>My image</alt>
</img>I dislike XML, the confusion between attributes and sub elements is one of the worst bits.
That is what your code would look like to browsers that didn't know about the new elements. HTML is defined such that browsers can ignore unknown elements for compatibility and still display the text. Using contents for the metadata means that browsers need to know about the elements to at least hide the text.
This is why *ML is a stupid-ass way to do things. "the problem it solves is not hard, and it does not solve the problem well."
JSON is great as an interchange format, but there are many reasons editing it by hand is painful, lack of comments and lack of newlines in strings not being the least of them.