cferdinandi / validate

A lightweight form validation script.
MIT License
230 stars 39 forks source link

Use browser's validation if available #25

Closed FloEdelmann closed 7 years ago

FloEdelmann commented 7 years ago

This provides a better fallback, especially for browsers that implement the spec correctly and don't let the field's value be in an invalid state. See my comment at #20.

I also added the polyfill for other element types than <input> (namely <select>, <textarea> and <button>) as the Constraint Validation API is available for all these tags according to MDN. Note: I also don't know why one should want to validate a button...

Closes #20 and #19.

cferdinandi commented 7 years ago

Dude, this is awesome, thank you! Merged!