With this plugin you can write CSS without the vendor prefixes. The plugin takes care of it and will automatically add vendor prefixes. This will save time and the pain of rewriting same attribute many times.
For example the css3 attribute transform need to have the prefix
-moz-in Firefox-ms-in Internet explorer-webkit-in Chrome, Safari
Simply add this line of code to your site
<script src="https://cdnjs.cloudflare.com/ajax/libs/css3finalize/4.0.1/jquery.css3finalize.min.js"></script>
Once the script is loaded it will search for style-tags and link-tags (within same domain) and parse them.
If you don't want the script to automatically load and parse then you could set this code
<script>
// Disable autoload
window.cssFinalize=false;
// DOM is ready
jQuery(function($) {
// Start parse
$('style, link').cssFinalize();
});
</script>
// Which node CSS3 Finalize should read and add vendor prefixes
node : 'style,link',
// If it should add the vendor prefixes
append : true,
// This will be called for each nodes after vendor prefixes have been appended
callback : function(css) {}
This script has been tested in IE 10-11, FF, Webkit
- The script can only read link-tags where it source are from same domain.
- Link-tags cannot be read on webkit and Opera on local files.
You can leave out the prefix when setting a style in jQuery css method.
Example
$('a').css({'width' : 'calc(100% - 80px)', 'column-width' : 10});
In normal case you would have needed to add a prefix
$('a').css({'width' : '-webkit-calc(100% - 80px)', '-moz-column-width' : 10});
Example using less.js post processing together with this script
less = {
postProcessor: function(css) {
var processedCSS = css;
if ($.cssFinalize) {
$('<textarea>').val(css).cssFinalize({
'append' : false,
'callback': function(css) {
processedCSS += $.cssFinalize.cssObjToText(css);
}
});
}
return processedCSS;
}
};
I appreciate all feedback, thanks! If you would like to donate you can send to this Bitcoin address 1FCT3xhLBRD1MUxnS1ppcLrbH9SCeZpu6D
2014年10月18日 - v4.1.0
2014年08月16日 - v4.0.1
2014年05月24日 - v4.0.0
Version 4 have been updated to support IE10+ and other modern browsers. CSS Flex fallback support
(codler)
2013年03月29日 - v3.4.0
- Fix for jQuery 2.0b2 (codler)
2013年02月23日 - v3.3
2012年11月30日 - v3.2
2012年09月06日 - v3.1
2012年08月21日 - v3.0
The time has come to drop support for older browser.
Version 3 have been updated to support IE9+ and latest version of Firefox, Chrome, Safari and Opera since they have auto update.
The minified version is alot smaller now.
Fixes old bugs
(codler)
2012年08月19日 - v2.5
2012年05月07日 - v2.4
2012年02月14日 - v2.3
2012年02月09日 - v2.2
- Fix valueRules in CSSHooks. (codler)
... See commit log ...
2011年08月08日 - v1.45
... See commit log ...
2010年10月26日 - v1.0
- First commit. (codler)