Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: third_party/polymer/v0_8/components-chromium/iron-validatable-behavior/iron-validatable-behavior-extracted.js

Issue 1162563004: Upgrade to 1.0 and switch clients to dom-repeat where needed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix a layout import and remove the gzipped webanimation in reproduce.sh Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/polymer/v0_8/components-chromium/iron-validatable-behavior/iron-validatable-behavior-extracted.js
diff --git a/third_party/polymer/v0_8/components-chromium/iron-validatable-behavior/iron-validatable-behavior-extracted.js b/third_party/polymer/v0_8/components-chromium/iron-validatable-behavior/iron-validatable-behavior-extracted.js
new file mode 100644
index 0000000000000000000000000000000000000000..e39fd9e59c4e50b02a0e423fdb56b110b5eee88c
--- /dev/null
+++ b/third_party/polymer/v0_8/components-chromium/iron-validatable-behavior/iron-validatable-behavior-extracted.js
@@ -0,0 +1,86 @@
+
+
+ /**
+ * Use `Polymer.IronValidatableBehavior` to implement an element that validates user input.
+ *
+ * ### Accessiblity
+ *
+ * Changing the `invalid` property, either manually or by calling `validate()` will update the
+ * `aria-invalid` attribute.
+ *
+ * @demo demo/index.html
+ * @polymerBehavior
+ */
+ Polymer.IronValidatableBehavior = {
+
+ properties: {
+
+ /**
+ * Namespace for this validator.
+ */
+ validatorType: {
+ type: String,
+ value: 'validator'
+ },
+
+ /**
+ * Name of the validator to use.
+ */
+ validator: {
+ type: String
+ },
+
+ /**
+ * True if the last call to `validate` is invalid.
+ */
+ invalid: {
+ reflectToAttribute: true,
+ type: Boolean,
+ value: false
+ },
+
+ _validatorMeta: {
+ type: Object
+ }
+
+ },
+
+ observers: [
+ '_invalidChanged(invalid)'
+ ],
+
+ get _validator() {
+ return this._validatorMeta && this._validatorMeta.byKey(this.validator);
+ },
+
+ ready: function() {
+ this._validatorMeta = new Polymer.IronMeta({type: this.validatorType});
+ },
+
+ _invalidChanged: function() {
+ if (this.invalid) {
+ this.setAttribute('aria-invalid', 'true');
+ } else {
+ this.removeAttribute('aria-invalid');
+ }
+ },
+
+ /**
+ * @return {Boolean} True if the validator `validator` exists.
+ */
+ hasValidator: function() {
+ return this._validator != null;
+ },
+
+ /**
+ * @param {Object} values Passed to the validator's `validate()` function.
+ * @return {Boolean} True if `values` is valid.
+ */
+ validate: function(values) {
+ var valid = this._validator && this._validator.validate(values);
+ this.invalid = !valid;
+ return valid;
+ }
+
+ };
+

Powered by Google App Engine
This is Rietveld 408576698