{"id":1110,"date":"2013-06-19T07:36:54","date_gmt":"2013-06-19T13:36:54","guid":{"rendered":"http:\/\/cbateman.com\/blog\/?p=1110"},"modified":"2014-10-09T22:33:20","modified_gmt":"2014-10-10T03:33:20","slug":"vendor-prefixes-youre-doing-it-wrong","status":"publish","type":"post","link":"https:\/\/cbateman.com\/blog\/vendor-prefixes-youre-doing-it-wrong\/","title":{"rendered":"Vendor Prefixes: You&#8217;re Doing it Wrong (and by &#8216;you&#8217; I mean me)"},"content":{"rendered":"<p>About six months ago (sorry, I meant to write this post sooner), I almost pushed some CSS to production that would have caused some trouble.<\/p>\r\n\r\n<pre class=\"pre\">\r\nbackground: -webkit-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:    -moz-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:      -o-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:         linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\n<\/pre>\r\n\r\n<p>Looks pretty innocent at first glance, but there&#8217;s a major issue. Did you spot it?<\/p>\r\n\r\n<p>I&#8217;d gotten so used to dropping in vendor prefixes that I&#8217;d forgotten what they really are: experimental implementations of potentially unfinished specifications. So I wrote the unprefixed version at the end without a second thought. Imagine my surprise when my browser updated and the gradient turned completely backwards.<\/p>\r\n\r\n<p>The <a href=\"http:\/\/www.w3.org\/TR\/2011\/WD-css3-images-20110217\/#linear-gradients\">old draft<\/a> &#8211; and all the unprefixed implementations &#8211; use algebraic notation for angles, which means that 0 degrees points to the right and moves counter-clockwise. However, in the <a href=\"http:\/\/www.w3.org\/TR\/css3-images\/#linear-gradients\">candidate recommendation<\/a>, 0 degrees points up and moves clockwise. So this is what I really needed:<\/p>\r\n\r\n<pre class=\"pre\">\r\nbackground: -webkit-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:    -moz-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:      -o-linear-gradient(-45deg, #CFCFCF, #DADADA 15px);\r\nbackground:         linear-gradient(135deg, #CFCFCF, #DADADA 15px);\r\n<\/pre>\r\n\r\n<p>And so I learned an embarrassing lesson: don&#8217;t write an unprefixed property before it&#8217;s been implemented by a major browser &#8211; demonstrating that the standard is stable.<\/p>\r\n\r\n<p>And then Chrome came out with Blink and said <a href=\"http:\/\/www.chromium.org\/blink#vendor-prefixes\">no more prefixes<\/a> (Firefox <a href=\"http:\/\/lists.w3.org\/Archives\/Public\/public-webapps\/2012OctDec\/0731.html\">too<\/a>). So I guess I should have learned my lesson sooner. Oh well.<\/p>\r\n\r\n<p>For more pontification on vendor prefixes, here&#8217;s <a href=\"http:\/\/www.paulirish.com\/2012\/vendor-prefixes-are-not-developer-friendly\/\">Paul<\/a> and <a href=\"http:\/\/www.nczonline.net\/blog\/2013\/04\/30\/blink-and-the-end-of-vendor-prefixes\/\">Nicholas<\/a>.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>About six months ago (sorry, I meant to write this post sooner), I almost pushed some CSS to production that would have caused some trouble. background: -webkit-linear-gradient(-45deg, #CFCFCF, #DADADA 15px); background: -moz-linear-gradient(-45deg, #CFCFCF, #DADADA 15px); background: -o-linear-gradient(-45deg, #CFCFCF, #DADADA 15px); background: linear-gradient(-45deg, #CFCFCF, #DADADA 15px); Looks pretty innocent at first glance, but there&#8217;s a major issue. Did you spot it?&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-1110","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/posts\/1110"}],"collection":[{"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/comments?post=1110"}],"version-history":[{"count":25,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/posts\/1110\/revisions"}],"predecessor-version":[{"id":1370,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/posts\/1110\/revisions\/1370"}],"wp:attachment":[{"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/media?parent=1110"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/categories?post=1110"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cbateman.com\/blog\/wp-json\/wp\/v2\/tags?post=1110"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}