https://github.com/jaydenseric/constraint-validation-buggyfill
Prevents invalid form submission in browsers that improperly support the HTML forms spec (i.e. Safari).
https://github.com/jaydenseric/constraint-validation-buggyfill
npm
Last synced: 11 days ago
JSON representation
Prevents invalid form submission in browsers that improperly support the HTML forms spec (i.e. Safari).
- Host: GitHub
- URL: https://github.com/jaydenseric/constraint-validation-buggyfill
- Owner: jaydenseric
- Created: 2016-08-21T13:47:41.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-12-31T08:33:12.000Z (over 5 years ago)
- Last Synced: 2025-06-15T12:06:19.554Z (21 days ago)
- Topics: npm
- Language: JavaScript
- Homepage: https://npm.im/constraint-validation-buggyfill
- Size: 16.6 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- Changelog: changelog.md
- Funding: .github/funding.yml
Awesome Lists containing this project
README
# constraint-validation-buggyfill
[](https://npm.im/constraint-validation-buggyfill) [](https://github.com/jaydenseric/constraint-validation-buggyfill/actions)
Prevents invalid form submission in browsers that improperly support the HTML forms spec (e.g. Safari v5 → 10). The first invalid element is focused after alerting the validation message. An alert is used due to poor browser support for [`reportValidity()`](https://developer.mozilla.org/en-US/docs/Web/API/HTMLFormElement/reportValidity).
## Setup
### npm setup
To install from [npm](https://npmjs.com) run:
```sh
npm install constraint-validation-buggyfill
```Add this import to components with forms:
```js
import 'constraint-validation-buggyfill'
```### CDN setup
To install from [npm](https://npmjs.com) via the [UNPKG CDN](https://unpkg.com), add this script to pages with forms:
```html
```
## Support
- Node.js v10+
- Browsers [`> 0.5%, not dead, IE >= 10, ExplorerMobile >= 10, Firefox >= 4, Chrome >= 10, Safari >= 5, iOS >= 4, Android >= 4, BlackBerry >= 7, KaiOS >= 2.5`](https://browserl.ist/?q=%3E+0.5%25%2C+not+dead%2C+IE+%3E%3D+10%2C+ExplorerMobile+%3E%3D+10%2C+Firefox+%3E%3D+4%2C+Chrome+%3E%3D+10%2C+Safari+%3E%3D+5%2C+iOS+%3E%3D+4%2C+Android+%3E%3D+4%2C+BlackBerry+%3E%3D+7%2C+KaiOS+%3E%3D+2.5)## See
- [Caniuse: Form validation](http://caniuse.com/#feat=form-validation)
- [WebKit Bugzilla: Support for interactive validation of form elements](https://bugs.webkit.org/show_bug.cgi?id=28649)
- [W3C HTML form submission algorithm](https://www.w3.org/TR/html52/sec-forms.html#form-submission-algorithm)
- [WHATWG HTML form submission algorithm](https://html.spec.whatwg.org/multipage/forms.html#form-submission-algorithm)