Modernizr Build Status Inline docs

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.

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

This project adheres to the [Open Code of Conduct][code-of-conduct]. By participating, you are expected to honor this code. [code-of-conduct]: http://todogroup.org/opencodeofconduct/#Modernizr/conduct@modernizr.com

New Asynchronous Event Listeners

Often times people want to know when an asynchronous test is done so they can allow their application to react to it. In the past, you've had to rely on watching properties or <html> classes. Only events on asynchronous tests are supported. Synchronous tests should be handled synchronously to improve speed and to maintain consistency.

The new API looks like this:

// Listen to a test, give it a callback
Modernizr.on('testname', function( result ) {
  if (result) {
    console.log('The test passed!');
  }
  else {
    console.log('The test failed!');
  }
});

We guarantee that we'll only invoke your function once (per time that you call on). We are currently not exposing a method for exposing the trigger functionality. Instead, if you'd like to have control over async tests, use the src/addTest feature, and any test that you set will automatically expose and trigger the on functionality.

Getting Started

  • Clone or download the repository
  • Install project dependencies with npm install

Test suite

Run the test suite

Building Modernizr v3

To generate everything in 'config-all.json':

npm install
./bin/modernizr -c lib/config-all.json
//outputs to ./modernizr.js

To run tests (in phantom):

grunt test

To run tests (in browser):

grunt build
serve .
visit <url>/test

To see simple build in browser:

serve the root dir, <url>/test/modular.html

To see the build tool:

  • checkout the modernizr.com code
  • install all your gems and bundles and jekyll
  • jekyll
  • serve ./_sites
  • visit /download
  • It should be just a big list of things you can build with no frills.

API Reference

Modernizr can be used programmatically via npm:

var modernizr = require("modernizr");

Building

A build method is exposed for generating custom Modernizr builds. Example:

var modernizr = require("modernizr");

modernizr.build({}, function (result) {
  console.log(result); // the build
});

The first parameter takes a JSON object of options and feature-detects to include. See lib/config-all.json for all available options.

The second parameter is a function invoked on task completion.

License

MIT License



Modernizr Build Status Inline docs

Modernizr is a JavaScript library that detects HTML5 and CSS3 features in the user’s browser.
Modernizr测试当前UA中可用的本机CSS3和HTML5功能,并通过两种方式使结果可用:作为全局 Modernizr 对象的属性,以及&lt; html&gt; 元素。此信息可让您逐步增强您的网页的细节级控制体验。

该项目遵守[开放行为准则] [行为准则]。通过参与,您将遵守此代码。 [行为准则]: http://todogroup.org/opencodeofconduct/#Modernizr/conduct@modernizr。 com

新的异步事件侦听器

人们通常会想知道什么时候进行异步测试,以便他们可以允许他们的应用对它进行反应。 过去,您不得不依赖于观看属性或&lt; html&gt; 类。只有异步测试的事件才是 支持的。同步测试应同步处理,以提高速度并保持一致性。

新API如下所示:

// Listen to a test, give it a callback
Modernizr.on('testname', function( result ) {
  if (result) {
    console.log('The test passed!');
  }
  else {
    console.log('The test failed!');
  }
});

我们保证只会调用您的函数一次(每次您在上调用)。我们目前没有曝光 一种暴露触发器功能的方法。相反,如果您想要控制异步测试,请使用 src / addTest 功能,您设置的任何测试将自动公开和触发功能上的

入门指南

  • 克隆或下载存储库
  • 使用 npm install
  • 安装项目依赖关系

测试套件

运行测试套件

建立Modernizr v3

生成’config-all.json’中的所有内容:

npm install
./bin/modernizr -c lib/config-all.json
//outputs to ./modernizr.js

运行测试(幻影):

grunt test

运行测试(在浏览器中):

grunt build
serve .
visit <url>/test

要查看浏览器中的简单构建:

提供根目录,&lt; url&gt; /test/modular.html

查看构建工具:

    检查modernizr.com代码
  • 安装所有的宝石和束和jekyll
  • jekyll
  • serve ./_ sites
  • 访问/下载
  • 应该只是一个很大的列表,你可以创建没有装饰的东西。

API参考

Modernizr可以通过npm:

以编程方式使用
var modernizr = require("modernizr");

Building

build 方法用于生成自定义Modernizr构建。示例:

var modernizr = require("modernizr");

modernizr.build({}, function (result) { console.log(result); // the build });

第一个参数使用JSON对象的选项和特征检测来包含。有关所有可用选项,请参阅 lib / config-all.json

第二个参数是在任务完成时调用的函数

许可证

麻省理工学院许可证




相关问题推荐