NameDateSize

..16-Mar-201612 KiB

.coveralls.yml20-Apr-201546

.editorconfig05-Aug-2014207

.gitattributes09-Nov-201593

.gitignore25-Feb-2015119

.jscsrc30-Nov-2015725

.jshintignore13-Mar-201440

.jshintrc27-Apr-20152.6 KiB

.npmignore07-Apr-201585

.travis.yml21-Sep-20151.8 KiB

appveyor.yml21-Sep-2015420

bin/14-Oct-20154 KiB

feature-detects/11-Dec-20154 KiB

Gruntfile.js30-Nov-20155.9 KiB

lib/10-Dec-20154 KiB

LICENSE02-Feb-201548

media/09-Nov-20154 KiB

package.json09-Dec-20152.3 KiB

readme.md09-Nov-20153.4 KiB

src/30-Nov-20154 KiB

test/27-Apr-20154 KiB

readme.md

1# Modernizr [![Build Status](https://api.travis-ci.org/Modernizr/Modernizr.svg?branch=master)](http://travis-ci.org/Modernizr/Modernizr) [![Inline docs](http://inch-ci.org/github/Modernizr/Modernizr.svg?branch=master)](http://inch-ci.org/github/Modernizr/Modernizr)
2
3##### Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
4
5- [Website](http://www.modernizr.com)
6- [Documentation](http://www.modernizr.com/docs/)
7
8Modernizr tests which native CSS3 and HTML5 features are available in the current UA and makes the results available to you in two ways: as properties on a global `Modernizr` object, and as classes on the `<html>` element. This information allows you to progressively enhance your pages with a granular level of control over the experience.
9
10This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code.
11[code-of-conduct]: http://todogroup.org/opencodeofconduct/#Modernizr/conduct@modernizr.com
12
13## New Asynchronous Event Listeners
14
15Often times people want to know when an asynchronous test is done so they can allow their application to react to it.
16In the past, you've had to rely on watching properties or `<html>` classes. Only events on **asynchronous** tests are
17supported. Synchronous tests should be handled synchronously to improve speed and to maintain consistency.
18
19The new API looks like this:
20
21```javascript
22// Listen to a test, give it a callback
23Modernizr.on('testname', function( result ) {
24  if (result) {
25    console.log('The test passed!');
26  }
27  else {
28    console.log('The test failed!');
29  }
30});
31```
32
33We guarantee that we'll only invoke your function once (per time that you call `on`). We are currently not exposing
34a method for exposing the `trigger` functionality. Instead, if you'd like to have control over async tests, use the
35`src/addTest` feature, and any test that you set will automatically expose and trigger the `on` functionality.
36
37## Getting Started
38
39- Clone or download the repository
40- Install project dependencies with `npm install`
41
42## Test suite
43
44Run the [test suite](http://modernizr.github.com/Modernizr/test/)
45
46## Building Modernizr v3
47
48### To generate everything in 'config-all.json':
49
50```js
51npm install
52./bin/modernizr -c lib/config-all.json
53//outputs to ./modernizr.js
54```
55
56### To run tests (in phantom):
57
58```js
59grunt test
60```
61
62### To run tests (in browser):
63
64```shell
65grunt build
66serve .
67visit <url>/test
68```
69
70### To see simple build in browser:
71
72serve the root dir, `<url>/test/modular.html`
73
74### To see the build tool:
75
76* checkout the modernizr.com code
77* install all your gems and bundles and jekyll and shit
78* `jekyll`
79* `serve ./_sites`
80* visit <url>/download
81* It should be just a big list of things you can build with no frills.
82
83### API Reference
84
85Modernizr can be used programmatically via npm:
86
87```javascript
88var modernizr = require("modernizr");
89```
90
91#### Building
92
93A `build` method is exposed for generating custom Modernizr builds. Example:
94
95```javascript
96var modernizr = require("modernizr");
97
98modernizr.build({}, function (result) {
99  console.log(result); // the build
100});
101```
102
103The first parameter takes a JSON object of options and feature-detects to include. See [`lib/config-all.json`](lib/config-all.json) for all available options.
104
105The second parameter is a function invoked on task completion.
106
107## License
108
109[MIT License](http://opensource.org/licenses/MIT)
110