[wp-hackers] Using Modernizr for the new html5 input types

Alex Hempton-Smith hempsworth at gmail.com
Mon Aug 22 18:17:41 UTC 2011


I think this will do the trick: http://pastie.org/2412654

Warning, it's quick n dirty, but it works. It's basically just a function
which loops through the scripts and styles that have been enqueued and
echoes their URL's in a comma separated list, suitable for modernizr.

Simply define which scripts/styles you'd like by providing the function with
an array of their handles.

- - - -
Kind regards,
Alex Hempton-Smith

www.alexhemptonsmith.com
www.twitter.com/hempsworth



On Mon, Aug 22, 2011 at 6:13 PM, Gerasimos Tsiamalos <tsiger at gmail.com>wrote:

> Well, that defeats the purpose doesn't it?
>
> On Mon, Aug 22, 2011 at 8:05 PM, Alexander Hempton-Smith <
> hempsworth at gmail.com> wrote:
>
> > I'm not familiar with modernizr (although looking now, I think I might
> > start to use it!)
> >
> > However, could you check the browser and version using
> > wp_check_browser_version() before you register and enqueue your
> > scripts?...
> >
> > - Alex
> >
> > Sent from my iPhone
> >
> > On 22 Aug 2011, at 17:40, Gerasimos Tsiamalos <tsiger at gmail.com> wrote:
> >
> > > Hello everyone,
> > >
> > > I am using Modernizr to test for some new html5 input types (number and
> > > range to be more specific) and i was wondering if it's possible to
> > combine
> > > this test with wp_register_script / wp_enqueue_script. I mean for
> > browsers
> > > that natively support this type of inputs, everything's fine but for
> the
> > > older ones i don't want to manually include my libraries. Here's an
> > example:
> > >
> > > *Modernizr.load([*
> > > *  {   *
> > > *    test : Modernizr.inputtypes.number, // my test  *
> > > *    nope : [spinbox_js,spinbox_css], // if no support, load my custom
> > libs*
> > > *    complete: function() { *
> > > *    ** **jQuery('.html5-number').spinbox(); // do my thing ** *
> > > *    }*
> > > *  }*
> > > *]);*
> > >
> > > Wouldn't be great if in the "nope" method i could include my libs using
> > > wp_register_script/wp_enqueue_script?
> > >
> > >
> > > --
> > > Best Regards
> > > --
> > > *Gerasimos Tsiamalos*
> > > twitter: @tsiger <http://www.twitter.com/tsiger>
> > > _______________________________________________
> > > wp-hackers mailing list
> > > wp-hackers at lists.automattic.com
> > > http://lists.automattic.com/mailman/listinfo/wp-hackers
> > _______________________________________________
> > wp-hackers mailing list
> > wp-hackers at lists.automattic.com
> > http://lists.automattic.com/mailman/listinfo/wp-hackers
> >
>
>
>
> --
> Best Regards
> --
> *Gerasimos Tsiamalos*
> Web Developer
> 8 A.Papandreou str, Thessaloniki, 57010
> t: +30 2310 358548
> blog: http://www.theportraitofageek.com
> psd2html: http://www.xhtmlme.com
> themes: http://www.cssigniter.com
> <http://www.cssigniter.com>resources: http://webtoolkit4.me
> twitter: @tsiger <http://www.twitter.com/tsiger>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list