So, if you haven’t heard, some web browser vendors are considering adopting -webkit- css prefixes because a whole lot of developers have been writing css that only uses the webkit prefixed versions of some of the new css3 properties. Bruce Lawson has a nice longer summary of what’s been going on, if you want it. Frankly I haven’t been paying a huge amount of attention because it all seems so silly (haven’t we been down this road before? IE6 was the good browser…), but I’ve been informed that my point of view is an unusual position that no one else has been taking, and that I should blog about this. This probably means that no one agrees with me, but anyway.
The thing is, after several years of using new css3 properties, I kind of like vendor prefixes for several reasons:
- They’re a big red flag that says that this property, in particular, is not stable or finished, and is subject to change (see, for example, the gradient property, which has changed quite a few times over the past couple of years). I should use it with caution, pay attention to future changes in the spec, and be prepared to update my code. I have limited amounts of attention, so it’s nice to know right when I’m using them which ones in particular might break.
- They let me turn things off for particular browsers. Webkit implements things early so you can play, but it’s often sloppy and doesn’t always address all the edge cases right away. Usually when something makes it into firefox it’s got all of the common uses covered. I have, in production code, intentionally put in the -moz- and un-prefixed version of a css property and left the -webkit- version out. I can still do this, since it’s the webkit version that may get implemented in other browsers, but imagine if it were the other way. I like being able to separate one browser from another when it comes to the new experimental properties.
Now, I will grant you that using the prefixes is annoying and harder to read and maintain, but as someone who has made sites work with the IE peekaboo bug and other nasties, it really isn’t that hard. Annoying, but really not that bad. And I don’t compile my css, but I hear there are tools that will automatically prefix for you. For me, the potential benefits outweigh the difficulty.
And I do honestly wonder how many actual production websites are ruined in non-webkit browsers because the developer only used -webkit- prefixes. I’ve seen all sorts of webkit-only demo sites that could in fact work in other browsers if the developer had made the extra effort, but I don’t think tech demo sites should really count. What are the broken mass-market websites? And what is broken, and why? If there are properties that are only available in webkit that are necessary for a site to function, perhaps the better answer would be to fast-track those properties into the spec?