Gathering detailed insights and metrics for @polymer/iron-validatable-behavior
Gathering detailed insights and metrics for @polymer/iron-validatable-behavior
Gathering detailed insights and metrics for @polymer/iron-validatable-behavior
Gathering detailed insights and metrics for @polymer/iron-validatable-behavior
Implements an element validated with Polymer.IronValidatorBehavior
npm install @polymer/iron-validatable-behavior
Typescript
Module System
Node Version
NPM Version
JavaScript (64.55%)
HTML (35.45%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
7 Stars
149 Commits
18 Forks
15 Watchers
12 Branches
26 Contributors
Updated on Dec 19, 2024
Latest Version
3.0.1
Package Id
@polymer/iron-validatable-behavior@3.0.1
Size
5.97 kB
NPM Version
6.4.1
Node Version
10.9.0
Published on
Sep 14, 2018
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Use IronValidatableBehavior
to implement an element that validates user input. By using this behaviour, your custom element will get a public validate()
method, which
will return the validity of the element, and a corresponding invalid
attribute,
which can be used for styling. Can be used alongside an element implementing
the IronValidatableBehavior
behaviour.
See: Documentation, Demo.
npm install --save @polymer/iron-validatable-behavior
1import {PolymerElement, html} from '@polymer/polymer'; 2import {mixinBehaviors} from '@polymer/polymer/lib/legacy/class.js'; 3import {IronValidatableBehavior} from '@polymer/iron-validatable-behavior/iron-validatable-behavior.js'; 4 5class SampleElement extends mixinBehaviors([IronValidatableBehavior], PolymerElement) { 6 static get template() { 7 return html` 8 <style> 9 :host { 10 border: 1px solid green; 11 color: green; 12 } 13 :host([invalid]) { 14 border: 1px solid red; 15 color: red; 16 } 17 </style> 18 <input id="input"> 19 `; 20 21 // Override this method if you want to implement custom validity 22 // for your element. This element is only valid if the value in the 23 // input is "cat". 24 function _getValidity() { 25 return this.$.input.value === 'cat'; 26 } 27 } 28} 29customElements.define('sample-element', SampleElement);
1<html> 2 <head> 3 <script type="module" src="./sample-element.js"></script> 4 </head> 5 <body> 6 <sample-element id="el"></sample-element> 7 <button onclick="el.validate()">Validate!</button> 8 </body> 9</html>
If you want to send a PR to this element, here are the instructions for running the tests and demo locally:
1git clone https://github.com/PolymerElements/iron-validatable-behavior 2cd iron-validatable-behavior 3npm install 4npm install -g polymer-cli
1polymer serve --npm 2open http://127.0.0.1:<port>/demo/
1polymer test --npm
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 3/26 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
32 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-07-14
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More