jQuery plugin for cross browser css compatibility

2019-08-17 06:07发布

问题:

In my app users will be able to change element's border style attributes like radius, color, width, style etc.

Now I also need to be able to get these attributes with jQuery, however in order to get something like border-radius, you need to use css("border-top-left-radius") (at least in new versions of firefox and chrome) and this will not work in all browsers, so my question is:

Is there a plugin that adds correct prefix to the css selector like webkit, moz etc. and maybe also makes these css features cross-browser compatible when setting these attributes?

Many thanks.

回答1:

-prefix-free by Lea Verou offers a jQuery plugin that simply integrates the -prefix-free script itself with jQuery's .css() method.

All the script itself does is add vendor prefixes to CSS properties where appropriate so you don't have to. It doesn't do anything else like polyfills.