{"id":349,"date":"2012-08-21T01:29:05","date_gmt":"2012-08-21T01:29:05","guid":{"rendered":"http:\/\/www.w3.org\/community\/respimg\/?p=349"},"modified":"2012-08-21T01:29:05","modified_gmt":"2012-08-21T01:29:05","slug":"thoughts-on-adding-a-type-attribute-2","status":"publish","type":"post","link":"https:\/\/www.w3.org\/community\/respimg\/2012\/08\/21\/thoughts-on-adding-a-type-attribute-2\/","title":{"rendered":"Thoughts on adding a type attribute"},"content":{"rendered":"<p><a href=\"http:\/\/www.w3.org\/community\/respimg\/2012\/03\/29\/while-were-here-shall-we-fix-file-format-issues\/\" target=\"_blank\">Matt Wilcox brought this idea up a few months ago<\/a>, but the issue seemed to fall off the table and was lost in other discussions. It&#8217;s something I&#8217;d like to see get some more feedback and general discussion from other developers so I&#8217;m bringing it back up. Below are some thoughts I&#8217;ve put together for adding a type attribute to source tags in the picture element.<\/p>\n<ul>\n<li>A type attribute would allow for a native HTML way to use new image formats, which could help decrease the load of image assets, increase site performance, i.e. WebP, <a href=\"http:\/\/en.wikipedia.org\/wiki\/JPEG_XR\" target=\"_blank\" rel=\"nofollow\">JPEG-XR<\/a>.<\/li>\n<li>The type attribute could also be a starting point for responsive image formats. As an example, a user could specify a new responsive image format which streams its data per however that magic would work and if the new responsive image format is not supported in the browser, it could fallback to the next image in the source stack, depending on which media query is active in the source list.<\/li>\n<li>The idea of fallback images is something that is being worked on in CSS: <a>http:\/\/dev.w3.org\/csswg\/css4-images\/#image-notation<\/a><\/li>\n<li>Since the picture element markup is very similar to the HTML5 video element, it seems to just make sense to also include type attributes just like the video element.<\/li>\n<li>I&#8217;m curious if type could be an optional attribute and only needed if you are planning to use newer image formats that would need a fallback pattern. This would be ideal so developers don&#8217;t have to specify type=&#8221;image\/jpg&#8221; or type=&#8221;image\/png&#8221; on each source tag<\/li>\n<li>Adding a type attribute seems like a very future friendly and forward thinking action.<\/li>\n<\/ul>\n<p>Here is a gist of this concept: <a href=\"https:\/\/gist.github.com\/3410238\" target=\"_blank\" rel=\"nofollow\">https:\/\/gist.github.com\/3410238<\/a><\/p>\n<p>Adding the type attribute to source tags in the picture element seems to be beneficial with no apparent drawbacks. I&#8217;m sure there are some issues so feel free to let me know what your concerns and issues\/drawbacks are of adding a type attribute.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Matt Wilcox brought this idea up a few months ago, but the issue seemed to fall off the table and was lost in other discussions. It&#8217;s something I&#8217;d like to see get some more feedback and general discussion from other &hellip; <a href=\"https:\/\/www.w3.org\/community\/respimg\/2012\/08\/21\/thoughts-on-adding-a-type-attribute-2\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1382,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_s2mail":"yes","footnotes":""},"categories":[1],"tags":[],"class_list":["post-349","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/349","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/users\/1382"}],"replies":[{"embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/comments?post=349"}],"version-history":[{"count":1,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/349\/revisions"}],"predecessor-version":[{"id":350,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/posts\/349\/revisions\/350"}],"wp:attachment":[{"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/media?parent=349"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/categories?post=349"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.w3.org\/community\/respimg\/wp-json\/wp\/v2\/tags?post=349"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}