compose-form-up
Advanced tools
Comparing version 1.6.0 to 1.7.0
@@ -35,2 +35,7 @@ // Dependencies | ||
// Ensure all required inputs have aria-requrired attributes | ||
toolbox.slice( document.querySelectorAll( '[required]' ) ).forEach( function( element ) { | ||
element.setAttribute( 'aria-required', true ) | ||
}) | ||
// Watch input events | ||
@@ -97,2 +102,3 @@ Event.on( document, 'blur', '[required]', checkValidation ) | ||
el.classList.remove( 'invalid', 'valid' ) | ||
input.setAttribute( 'aria-invalid', false ) | ||
@@ -103,2 +109,3 @@ } else { | ||
el.classList.toggle( 'valid', valid ) | ||
input.setAttribute( 'aria-invalid', valid ) | ||
@@ -232,3 +239,3 @@ } | ||
if (msg ) msg.parentNode.removeChild( msg ) | ||
if ( msg ) msg.parentNode.removeChild( msg ) | ||
@@ -247,3 +254,4 @@ } | ||
if ( label ) { | ||
label.insertAdjacentHTML( 'beforeend', '<aside class="validation-message"><p>' + message + '</p></aside>' ) | ||
label.insertAdjacentHTML( 'beforeend', '<span class="validation-message hidden"><span class="validation-message-text" role="alert">' + message + '</span></span>' ) | ||
label.lastChild.classList.remove('hidden') // Allow for transition | ||
} | ||
@@ -250,0 +258,0 @@ |
{ | ||
"name": "compose-form-up", | ||
"version": "1.6.0", | ||
"version": "1.7.0", | ||
"description": "A lightweight HTML5 form validation utility", | ||
@@ -24,9 +24,6 @@ "main": "index.js", | ||
}, | ||
"homepage": "https://github.com/compose-ui/form-up#readme", | ||
"dependencies": { | ||
"compose-toolbox": "^1.0.0" | ||
}, | ||
"devDependencies": { | ||
@@ -33,0 +30,0 @@ "chai": "^3.5.0", |
@@ -65,3 +65,15 @@ # FormUp | ||
Using `invalidateField` you can easily invalidate a field's current value. | ||
```js | ||
formUp.invalidateField( element, [message] ) | ||
``` | ||
For example if you find a usename is already taken, you could invalidate the username field like this. | ||
```js | ||
var username = document.querySelector( 'input[name=username]' ) | ||
formUp.invalidateField( username, "Username: " + username.value + " is taken. ") | ||
``` | ||
## Progressive Forms | ||
@@ -68,0 +80,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
31047
612
205