Within #1030822-6: Modernizr 2 custom builder @lewisnyman suggested that we add each Modernizr test individually into the module, so that you could use a
modernizr_add_test() which would be a wrapper for
drupal_add_js(), providing feature detection on an inline, page-by-page basis. You would be guaranteed to have the test available when using
hook_modernizr_load(), as the module would ensure that all tests print before
Given that Modernizr v3 will be entirely modular, this is worth exploring. I think it would be a great 7.x-4.x feature if we were to undertake.
In addition to the current hooks which deal with library integration, this change would allow us to support feature detection within the module itself, closely maintaining parity with the upstream releases.
- It would allow modules to efficiently execute tests which are for some reason not included in the current Modernizr build being used on a website. They could be printed inline to save on http requests. We have an issue to detect tests within the current build which would prevent dupe tests: #1569398: "Download Modernizr" link on the settings page should include all tests currently within the JS file.
- It would allow for inclusion of Modernizr tests within Drupal's JS aggregates (in the rare case it is desired).
None I can think of. It would be optional to use.