Break free from CSS prefix hell!
The developer of this repository has not created any items for sale yet. Need a bug fixed? Help with integration? A different license? Create a request here:
A script that lets you use only unprefixed CSS properties everywhere. It works behind the scenes, adding the current browser’s prefix to any CSS code, only when it’s needed.
Note: To use -prefix-free you don't need to write any JS code, just to include prefixfree.js in your page. The following is meant mostly for plugin authors.
-prefix-free creates 2 global variables:
PrefixFree. StyleFix is a framework for building various CSS fixers and -prefix-free depends on it. Currently, StyleFix is bundled with -prefix-free and only available this way, but it might eventually get split to a separate project, with separate documentation.
An array of the current callbacks.
callbackto the queue of functions that will be called when fixing CSS code.
callbackwill be called with the following parameters:
and it should return the fixed CSS code.
Processes aelement and converts it to a element with fixed code. Relative URLs will be converted.
Fixes code inside aelement.
Fixes code inside the
styleattribute of an element. Will not work in IE and Firefox < 3.6 due to a bug those have with
getAttribute('style'): In IE invalid values of valid properties will be dropped, and in Firefox < 3.6 anything invalid will be dropped.
Utility methods that convert a string to camelCase and back.
The detected prefix of the current browser (like
The detected prefix of the current browser in camelCase format (like
PrefixFree.properties PrefixFree.functions PrefixFree.keywords PrefixFree.selectors PrefixFree.atrules
Properties/functions/keywords/etc that are only available with a prefix in the current browser.
PrefixFree.prefixCSS(code [, raw])
Prefixes the properties and values in the code passed with the prefix of the current browser, only when needed. If the second parameter is truthy, it also prefixes selectors and @-rules. This is the most useful method in -prefix-free.
Prefixes the passed selector or property. The property is prefixed even when it's supported prefix-less. These are more internal methods and I assume they won't be too useful in general.