I want to use some new HTML5 form attributes and input types on a web page. Some browsers already support them, others do not and never will. That's why I want to use Modernizr - and that was my problem.
As far as I understand, Modernizr itself is not a polyfill, but a script that can check if the browser is capable of some new HTML5 / CSS3 materials. If necessary, you can download a polyfill that "emulates" these functions so that they can be used in unworkable / old browsers. Is that right, I think?
As for testing / loading: What is the right or best way to load polyfills with Modernizr?
In the documentation, I found this:
Modernizr.load({ test: Modernizr.geolocation, yep : 'geo.js', nope: 'geo-polyfill.js' });
but some pages also do it like this:
if (Modernizr.touch){ // bind to touchstart, touchmove, etc and watch `event.streamId` } else { // bind to normal click, mousemove, etc }
Also, how do I know how these functions are called? Something like Modernizr.geolocation probably exists to detect every function?
The Modernizr GitHub repository also has many custom discovery features. How to implement this in my version of Modernizr? Or is it best to use their builder?
Safari works with HTML5 form validation, but there is no interface for displaying error messages. In principle, the function is only half implemented. This is why Modernizr gives a false positive in Safari, as already mentioned here: https://github.com/Modernizr/Modernizr/issues/266 Apparently, someone fixed this with such a user test, but I still haven't I understand how to use it. 1