Skip to content
This repository has been archived by the owner on Nov 10, 2018. It is now read-only.

Restore customError property in the ValidityState() polyfill #46

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/js/validityState-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
// Add valid property to validity object
checkValidity.valid = valid;

// Assume a custom error if there is a validation message present but all the other checks returned valid
if (checkValidity.valid && field.validationMessage !== '') {
checkValidity.customError = true;
checkValidity.valid = false;
}

// Return object
return checkValidity;

Expand Down
6 changes: 6 additions & 0 deletions static/js/validityState-polyfill.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@
// Add valid property to validity object
checkValidity.valid = valid;

// Assume a custom error if there is a validation message present but all the other checks returned valid
if (checkValidity.valid && field.validationMessage !== '') {
checkValidity.customError = true;
checkValidity.valid = false;
}

// Return object
return checkValidity;

Expand Down
2 changes: 1 addition & 1 deletion static/js/validityState-polyfill.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.