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

Side by Side Diff: lib/iron_validatable_behavior.dart

Issue 1418513006: update elements and fix some bugs (Closed) Base URL: git@github.com:dart-lang/polymer_elements.git@master
Patch Set: code review updates Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « lib/iron_selectable.dart ('k') | lib/neon_animated_pages.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update` 1 // DO NOT EDIT: auto-generated with `pub run custom_element_apigen:update`
2 2
3 /// Dart API for the polymer element `iron_validatable_behavior`. 3 /// Dart API for the polymer element `iron_validatable_behavior`.
4 @HtmlImport('iron_validatable_behavior_nodart.html') 4 @HtmlImport('iron_validatable_behavior_nodart.html')
5 library polymer_elements.lib.src.iron_validatable_behavior.iron_validatable_beha vior; 5 library polymer_elements.lib.src.iron_validatable_behavior.iron_validatable_beha vior;
6 6
7 import 'dart:html'; 7 import 'dart:html';
8 import 'dart:js' show JsArray, JsObject; 8 import 'dart:js' show JsArray, JsObject;
9 import 'package:web_components/web_components.dart'; 9 import 'package:web_components/web_components.dart';
10 import 'package:polymer_interop/polymer_interop.dart'; 10 import 'package:polymer_interop/polymer_interop.dart';
11 import 'iron_meta.dart'; 11 import 'iron_meta.dart';
12 12
13 /// Use `Polymer.IronValidatableBehavior` to implement an element that validates user input. 13 /// `Use Polymer.IronValidatableBehavior` to implement an element that validates user input.
14 /// Use the related `Polymer.IronValidatorBehavior` to add custom validation log ic to an iron-input.
15 ///
16 /// By default, an `<iron-form>` element validates its fields when the user pres ses the submit button.
17 /// To validate a form imperatively, call the form's `validate()` method, which in turn will
18 /// call `validate()` on all its children. By using `Polymer.IronValidatableBeha vior`, your
19 /// custom element will get a public `validate()`, which
20 /// will return the validity of the element, and a corresponding `invalid` attri bute,
21 /// which can be used for styling.
22 ///
23 /// To implement the custom validation logic of your element, you must override
24 /// the protected `_getValidity()` method of this behaviour, rather than `valida te()`.
25 /// See [this](https://github.com/PolymerElements/iron-form/blob/master/demo/sim ple-element.html)
26 /// for an example.
14 /// 27 ///
15 /// ### Accessibility 28 /// ### Accessibility
16 /// 29 ///
17 /// Changing the `invalid` property, either manually or by calling `validate()` will update the 30 /// Changing the `invalid` property, either manually or by calling `validate()` will update the
18 /// `aria-invalid` attribute. 31 /// `aria-invalid` attribute.
19 @BehaviorProxy(const ['Polymer', 'IronValidatableBehavior']) 32 @BehaviorProxy(const ['Polymer', 'IronValidatableBehavior'])
20 abstract class IronValidatableBehavior implements CustomElementProxyMixin { 33 abstract class IronValidatableBehavior implements CustomElementProxyMixin {
21 34
22 /// True if the last call to `validate` is invalid. 35 /// True if the last call to `validate` is invalid.
23 bool get invalid => jsElement[r'invalid']; 36 bool get invalid => jsElement[r'invalid'];
(...skipping 11 matching lines...) Expand all
35 jsElement.callMethod('hasValidator', []); 48 jsElement.callMethod('hasValidator', []);
36 49
37 /// Returns true if the `value` is valid, and updates `invalid`. If you want 50 /// Returns true if the `value` is valid, and updates `invalid`. If you want
38 /// your element to have custom validation logic, do not override this method; 51 /// your element to have custom validation logic, do not override this method;
39 /// override `_getValidity(value)` instead. 52 /// override `_getValidity(value)` instead.
40 /// [value]: The value to be validated. By default, it is passed 53 /// [value]: The value to be validated. By default, it is passed
41 /// to the validator's `validate()` function, if a validator is set. 54 /// to the validator's `validate()` function, if a validator is set.
42 bool validate(value) => 55 bool validate(value) =>
43 jsElement.callMethod('validate', [value]); 56 jsElement.callMethod('validate', [value]);
44 } 57 }
OLDNEW
« no previous file with comments | « lib/iron_selectable.dart ('k') | lib/neon_animated_pages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698