I need to test for browser support of the css text-shadow property. There is this polyfill available that does the job, but I cannot seem to get it to work in drupal + modernizr. The polyfill needs to test for Modernizr.textshadow and if there's no support, then load a .js and a .css file. Here's what I have in my theme.info:

modernizr[Modernizr.textshadow][nope][] = css/jquery.textshadow.css, js/jquery.textshadow.js

would this work, or do I need to do place each file in a separate test line? ...like so:

modernizr[Modernizr.textshadow][nope][] = css/jquery.textshadow.css
modernizr[Modernizr.textshadow][nope][] = js/jquery.textshadow.js

After I get an answer for this specific question, here's the final thing: how/where do I add this part:

$('h1').textshadow();

Thanx in advance.

Comments

rupl’s picture

You definitely need separate lines for each file. I do not think it's possible to comma-separate multiple files.

As for the callback: I have never tried to implement one from an .info file, so I would start by trying something like this:

modernizr[Modernizr.textshadow][callback][] = function(){ $('h1').textshadow(); }

The code may not handle the callback/complete functionality supported by the raw hook (look at the bottom of the 7.x-3.x API docs), so let me know how it works and we can tweak the API based on your findings.

rupl’s picture

Title: Need help adding a polyfill rule to a theme .info file. » callback/complete API options not available from a theme .info file
Component: Documentation » Code
Category: support » bug

They extended DrupalCon internet by two hours at the last second so I had time to test this and callback/complete are indeed broken :(

I added this line to themey.info on my local dev:

modernizr[Modernizr.boxshadow][callback][] = function() { alert('holla'); }

Which produces the following Modernizr.load():

Modernizr.load([{
  test: Modernizr.boxshadow,
  callback: http://modernizr/sites/all/themes/themey/function() { alert('holla'); },
}]);

The declaration is fine but I need to work on the output. Changing status to reflect the nature of the issue. As always, thanks for the report!

rupl’s picture

Status: Active » Fixed

This was committed to dev a while back but I forgot to update the issue. Fixed in the 7.x-3.0-beta2 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Anonymous’s picture

Issue summary: View changes

...no leading forth-slashes ;)