• Stars
    star
    3,841
  • Rank 11,439 (Top 0.3 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 13 years ago
  • Updated about 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Break free from CSS prefix hell!

-prefix-free

Break free from CSS prefix hell!

Project homepage

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.

API Documentation

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: 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.

StyleFix API Documentation

Properties

StyleFix.fixers

An array of the current callbacks.

Functions

StyleFix.register(callback)

Adds callback to the queue of functions that will be called when fixing CSS code. callback will be called with the following parameters:

  • css (String): The CSS code that is being processed,
  • 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),
  • 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)

and it should return the fixed CSS code.

StyleFix.link(linkElement)

Processes a <link rel="stylesheet"> element and converts it to a <style> element with fixed code. Relative URLs will be converted.

StyleFix.styleElement(styleElement)

Fixes code inside a <style> element.

StyleFix.styleAttribute(element)

Fixes code inside the style attribute 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.

StyleFix.camelCase(str)
StyleFix.deCamelCase(str)

Utility methods that convert a string to camelCase and back.

-prefix-free API Documentation

Properties

PrefixFree.prefix

The detected prefix of the current browser (like '-moz-' or '-webkit-')

PrefixFree.Prefix

The detected prefix of the current browser in camelCase format (like 'Moz' or 'Webkit')

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.

Functions

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.

PrefixFree.prefixSelector(selector)
PrefixFree.prefixProperty(property)

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.

More Repositories

1

awesomplete

Ultra lightweight, usable, beautiful autocomplete with zero dependencies.
JavaScript
6,964
star
2

animatable

One property, two values, endless possiblities
HTML
2,580
star
3

bliss

Blissful JavaScript
JavaScript
2,390
star
4

inspire.js

Lean, hackable, extensible slide deck framework. Previously known as CSSS.
JavaScript
1,717
star
5

color.js

Color conversion & manipulation library by the editors of the CSS Color specifications
JavaScript
1,581
star
6

css3patterns

The popular CSS3 patterns gallery, now on Github :)
HTML
1,415
star
7

stretchy

Form element autosizing, the way it should be
JavaScript
1,275
star
8

dabblet

An interactive CSS playground
JavaScript
817
star
9

dpi

dpi love - Easily find the DPI/PPI of any screen
JavaScript
748
star
10

multirange

A tiny polyfill for HTML5 multi-handle sliders
CSS
605
star
11

conic-gradient

Polyfill for conic-gradient() and repeating-conic-gradient()
HTML
486
star
12

rety

Record typing on one or more editors and replay it at will, to simulate live coding
JavaScript
383
star
13

parsel

A tiny, permissive CSS selector parser
TypeScript
361
star
14

md-block

A custom element for rendering stylable (light DOM) Markdown
JavaScript
283
star
15

regexplained

JavaScript
273
star
16

chainvas

Make APIs suck less
HTML
262
star
17

css3test

How does your browser score for its CSS3 support?
JavaScript
214
star
18

css.land

Hands on CSS demos
HTML
213
star
19

nudeui

Lea's kitchen sink of form components. WIP. Try at your own risk or come back later.
JavaScript
204
star
20

HTML5-Progress-polyfill

Polyfill for the HTML5 <progress> element
JavaScript
178
star
21

rgba.php

Script for automatic generation of one pixel alpha-transparent images for non-RGBA browsers to easily emulate RGBA colors in backgrounds
PHP
176
star
22

cubic-bezier

Playground for CSS bezier-based timing functions
JavaScript
169
star
23

markapp

Building apps by authoring HTML
CSS
134
star
24

duoload

Simple, client-side comparison of website loading behavior
CSS
130
star
25

play.csssecrets.io

CSS Secrets Book live demos
CSS
119
star
26

talks

All my talks (move still in progress)
HTML
92
star
27

incrementable

Increment length values in textfields
JavaScript
83
star
28

corner-shape

Play with corner-shape before it’s implemented!
JavaScript
75
star
29

StronglyTyped

A library for strongly typed properties & global variables in JavaScript
JavaScript
70
star
30

css-colors

Share & convert CSS colors
JavaScript
62
star
31

bubbly

[Unfinished] CSS speech bubbles made easy!
JavaScript
50
star
32

html-syntax-guidelines

48
star
33

whathecolor

CSS
47
star
34

css-almanac

Repo for planning & voting on which stats to study
SCSS
34
star
35

forkgasm

Lea & Chris’ culinary adventures
HTML
33
star
36

talks-list

Automatic talks list, generated from JSON. Unmaintained, use Mavo instead.
JavaScript
29
star
37

chroma-zone

Slides for my talk “The Chroma Zone: Engineering Color on the Web”
CSS
21
star
38

htest

Declarative, boilerplate-free unit testing
JavaScript
19
star
39

lea.verou.me

Towards a serverless lea.verou.me! WIP, either help out or move along.
JavaScript
17
star
40

mavoice

Prioritize features for open source projects
CSS
15
star
41

issue-closing

View issue closing stats for any repo!
HTML
14
star
42

missing-slice

The Missing Slice talk slides
HTML
12
star
43

hci.mit.edu

WIP. Preview:
HTML
12
star
44

tweeplus

Longer tweets, no strings attached.
JavaScript
11
star
45

brep

Write batch find & replace scripts that transform files with a simple human-readable syntax
JavaScript
10
star
46

leaverou.github.io

Just a data repo, I don't intend to put a website here for now
10
star
47

mygraine

A migraine tracker, built with Mavo. Work in progress, come back later.
HTML
9
star
48

bytesizematters

JavaScript
8
star
49

refresh-it

Refresh page resources without a page reload. An alternative to the heavyweight processes that take over your local server.
JavaScript
8
star
50

uist2017

Website for ACM UIST 2017
HTML
6
star
51

homesearch

A sample Mavo app for people looking for housing to store info about and compare the homes they are trying to decide between
HTML
6
star
52

feedback

Easily save & share lists of tweets and own your data. Made with Mavo.
HTML
5
star
53

eleventy-plugin-citations

JavaScript
5
star
54

my-lifesheets

HTML
4
star
55

expenses

App to generate summary of expenses, made with Mavo
CSS
4
star
56

rework-utils

Utilities to explore ASTs generated by the Rework CSS parser. Originally written for the Web Almanac.
JavaScript
3
star
57

mv-data

3
star
58

testlib

Just a test, move along
JavaScript
2
star
59

blissful-hooks

Deep extensibility for all!
JavaScript
2
star
60

labelizer

Manage repo labels (WIP)
JavaScript
1
star
61

contacts

1
star
62

zoe-eats

Baby food log, made with Mavo
1
star
63

zoelearns.com

JavaScript
1
star
64

website

1
star
65

pathed

Get/set/subset deep objects via readable, extensible paths. WIP.
JavaScript
1
star