In order for the Modernizr API to be truly useful, other modules and themes need to integrate it. We've got a couple patched already but it will take a bigger effort to bring the level of automation I envision for this thing:

  1. Getting modules to implement hook_modernizr_info() so they can declare their need for a specific Modernizr test.
  2. Getting them to use hook_modernizr_load() for supporting libs instead of drupal_add_js().

Example

The patch in #1935794-2: Move support for Modernizr into HTML5 submodule is a good example of what we need to tell them when requesting integration. It will be come easier as the list grows. Additionally, there's no need to include the 'source', 'type' or 'desc' parts in the hook anymore because I've moved all the metadata to a master list inside modernizr.args.inc, along with API changes for 3.1 that auto-detect which module or theme is supplying a test.

Official Docs for this process have been created

Here's the code from #1935794-2: Move support for Modernizr into HTML5 submodule

/**
 * Implements hook_modernizr_info().
 */
function geolocation_html5_modernizr_info() {
  $tests = array();
  $tests[] = 'geolocation';

  return $tests;
}

...or the shortest syntax possible (thanks @sreynen!)

/**
 * Implements hook_modernizr_info().
 */
function geolocation_html5_modernizr_info() {
  return array('geolocation');
}

Complete

Here is a list of modules and themes that already implement hook_modernizr_info().

Modules

Themes

To-do

Let's work on implementing hook_modernizr_info() within these modules:

Modules

Themes

Themes will declare tests within their info files. The syntax is very simple:

modernizr[tests][] = borderradius


This was blocked by #1923856: Extract Modernizr tests from themes, but if you download 7.x-3.x-dev (as of 2013-03-18) you can test theme integration just fine.

Comments

rupl’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Issue summary: View changes

Updated issue summary based on issue #1923856 being opened

rupl’s picture

Issue summary: View changes

Updated issue summary.

iwuv’s picture

Issue summary: View changes

Opened feature request issue for @font-your-face and contributed patch. Edited this Modernizr meta issue with link to @font-your-face feature request issue.

rupl’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Issue summary: View changes

Updated issue summary to include example and reflect current state of issues in other queues.

rupl’s picture

Issue summary: View changes

Updated issue summary.

iwuv’s picture

Which tests would be useful for HTML5 tools, Respond.js, and Webform?

I think Dynamic Background would benefit from a background-size test. I'm assuming most people will want to use background-size: cover; and utilizing Modernizr will allow more in the way of presentation/fallback options.

iwuv’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Hey Chad yes I think that module could benefit. Good thinking.

Just FYI the meat of the 3.1 API is in dev now. I have to clean some UI stuff up but it's stable and working with both the fontyourface and geolocation_html5 modules.

rupl’s picture

Issue summary: View changes

Updated issue summary.

rupl’s picture

Issue summary: View changes

Updated issue summary to include shortest syntax possible for hook. Updated supported/pending lists.

rupl’s picture

Issue summary: View changes

Updated issue summary to include Aurora

rupl’s picture

Issue summary: View changes

Updated issue summary adding dynamic background to module todos

rupl’s picture

Issue summary: View changes
rupl’s picture

Issue summary: View changes
rupl’s picture

Issue summary: View changes
rupl’s picture

Issue summary: View changes