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

Gerasimos Tsiamalos tsiger at gmail.com
Mon Aug 22 17:12:57 UTC 2011


Well yeah that's why i was trying to wrap my head around it for a while and
possibly find a solution but yeah i'm trying to get the most from 2
different worlds. I'll play a bit more with it though and come back with my
findings.

Don't you think though, that now with all those new HTML5 toys (css3, input
types, canvas) conditional resource loading would be great for WordPress?

On Mon, Aug 22, 2011 at 8:08 PM, Eric Mann <eric at eam.me> wrote:

> It would be nice, yes, but you're trying to do too much here.  Both
> `wp_register_script()` and `wp_enqueue_script()` run on the server side ...
> `Modernizr.load()` will fire the `nope` method on the client side ...
>
> So, really, there's no way to do exactly what you're doing.  My
> recommendation would be to use jQuery or another library to asynchrounously
> fetch your libraries when the `nope` method fires.
>
> On Mon, Aug 22, 2011 at 9:40 AM, 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>


More information about the wp-hackers mailing list