Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100755 68 lines (46 sloc) 3.185 kb
b86e43b Added project homepage to README since github no longer links to it
Lea Verou authored
1 # [-prefix-**free**](http://leaverou.github.com/prefixfree/)
0741267 Initial commit
Lea Verou authored
2 ## Break free from CSS prefix hell!
3
b86e43b Added project homepage to README since github no longer links to it
Lea Verou authored
4 [Project homepage](http://leaverou.github.com/prefixfree/)
5
0741267 Initial commit
Lea Verou authored
6 A script that lets you use only unprefixed CSS properties everywhere.
ccdb250 API documentation
Lea Verou authored
7 It works behind the scenes, adding the current browser’s prefix to any CSS code, only when it’s needed.
8
9 ## API Documentation
10 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.
11
c433b8a Split -prefix-free into StyleFix and -prefix-free (still in same file…
Lea Verou authored
12 -prefix-free creates 2 global variables: `StyleFix` and `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.
13
14 ## StyleFix API Documentation
15
16 ### Properties
17 StyleFix.fixers
18 An array of the current callbacks.
19
20 ### Functions
21 StyleFix.register(callback)
22 Adds `callback` to the queue of functions that will be called when fixing CSS code. `callback` will be called with the following parameters:
23
24 * **css** (String): The CSS code that is being processed,
25 * **raw** (Boolean): Whether the CSS code can contain rules etc or it's just a bunch of declarations (such as the ones found in the `style` attribute),
26 * **element** (HTMLElement): The node that the CSS code came from (such as a `<link>` element, a `<style>` element or any element with a `style` attribute)
27
28 and it should return the fixed CSS code.
29
30 StyleFix.link(linkElement)
31
32 Processes a `<link rel="stylesheet">` element and converts it to a `<style>` element with fixed code. Relative URLs will be converted.
33
34 StyleFix.styleElement(styleElement)
35
36 Fixes code inside a `<style>` element.
37
38 StyleFix.styleAttribute(element)
39
40 Fixes code inside the `style` attribute of an element. Will not work in IE and Firefox &lt; 3.6 due to a bug those have with `getAttribute('style')`: In IE invalid values of valid properties will be dropped, and in Firefox &lt; 3.6 anything invalid will be dropped.
41
42 StyleFix.camelCase(str)
43 StyleFix.deCamelCase(str)
44 Utility methods that convert a string to camelCase and back.
45
46 ## -prefix-free API Documentation
47
ccdb250 API documentation
Lea Verou authored
48 ### Properties
49 PrefixFree.prefix
50 The detected prefix of the current browser (like `'-moz-'` or `'-webkit-'`)
51
52 PrefixFree.Prefix
53 The detected prefix of the current browser in camelCase format (like `'Moz'` or `'Webkit'`)
54
55 PrefixFree.properties
a709c86 Separated keywords from functions, refactored prefixCSS
Lea Verou authored
56 PrefixFree.functions
57 PrefixFree.keywords
ccdb250 API documentation
Lea Verou authored
58 PrefixFree.selectors
59 PrefixFree.atrules
a709c86 Separated keywords from functions, refactored prefixCSS
Lea Verou authored
60 Properties/functions/keywords/etc that are **only** available with a prefix in the current browser.
ccdb250 API documentation
Lea Verou authored
61
c433b8a Split -prefix-free into StyleFix and -prefix-free (still in same file…
Lea Verou authored
62 ### Functions
ccdb250 API documentation
Lea Verou authored
63 PrefixFree.prefixCSS(code [, raw])
64 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.
65
66 PrefixFree.prefixSelector(selector)
67 PrefixFree.prefixProperty(property)
c433b8a Split -prefix-free into StyleFix and -prefix-free (still in same file…
Lea Verou authored
68 Prefixes the passed selector or property **even when it's supported prefix-less**. These are more internal methods and I assume they won't be too useful in general.
Something went wrong with that request. Please try again.