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

Side by Side Diff: third_party/polymer/v1_0/components-chromium/iron-checked-element-behavior/iron-checked-element-behavior-extracted.js

Issue 2158913007: Roll Polymer from 1.5.0 -> 1.6.0 to pick up native CSS custom props (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 4 years, 4 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 unified diff | Download patch
OLDNEW
1 /** 1 /**
2 * Use `Polymer.IronCheckedElementBehavior` to implement a custom element 2 * Use `Polymer.IronCheckedElementBehavior` to implement a custom element
3 * that has a `checked` property, which can be used for validation if the 3 * that has a `checked` property, which can be used for validation if the
4 * element is also `required`. Element instances implementing this behavior 4 * element is also `required`. Element instances implementing this behavior
5 * will also be registered for use in an `iron-form` element. 5 * will also be registered for use in an `iron-form` element.
6 * 6 *
7 * @demo demo/index.html 7 * @demo demo/index.html
8 * @polymerBehavior Polymer.IronCheckedElementBehavior 8 * @polymerBehavior Polymer.IronCheckedElementBehavior
9 */ 9 */
10 Polymer.IronCheckedElementBehaviorImpl = { 10 Polymer.IronCheckedElementBehaviorImpl = {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 created: function() { 52 created: function() {
53 // Used by `iron-form` to handle the case that an element with this behavi or 53 // Used by `iron-form` to handle the case that an element with this behavi or
54 // doesn't have a role of 'checkbox' or 'radio', but should still only be 54 // doesn't have a role of 'checkbox' or 'radio', but should still only be
55 // included when the form is serialized if `this.checked === true`. 55 // included when the form is serialized if `this.checked === true`.
56 this._hasIronCheckedElementBehavior = true; 56 this._hasIronCheckedElementBehavior = true;
57 }, 57 },
58 58
59 /** 59 /**
60 * Returns false if the element is required and not checked, and true otherw ise. 60 * Returns false if the element is required and not checked, and true otherw ise.
61 * @param {*=} _value Ignored. 61 * @param {*=} _value Ignored.
62 * @return {boolean} true if `required` is false, or if `required` and `chec ked` are both true. 62 * @return {boolean} true if `required` is false or if `checked` is true.
63 */ 63 */
64 _getValidity: function(_value) { 64 _getValidity: function(_value) {
65 return this.disabled || !this.required || (this.required && this.checked); 65 return this.disabled || !this.required || this.checked;
66 }, 66 },
67 67
68 /** 68 /**
69 * Update the aria-required label when `required` is changed. 69 * Update the aria-required label when `required` is changed.
70 */ 70 */
71 _requiredChanged: function() { 71 _requiredChanged: function() {
72 if (this.required) { 72 if (this.required) {
73 this.setAttribute('aria-required', 'true'); 73 this.setAttribute('aria-required', 'true');
74 } else { 74 } else {
75 this.removeAttribute('aria-required'); 75 this.removeAttribute('aria-required');
(...skipping 17 matching lines...) Expand all
93 } 93 }
94 } 94 }
95 }; 95 };
96 96
97 /** @polymerBehavior Polymer.IronCheckedElementBehavior */ 97 /** @polymerBehavior Polymer.IronCheckedElementBehavior */
98 Polymer.IronCheckedElementBehavior = [ 98 Polymer.IronCheckedElementBehavior = [
99 Polymer.IronFormElementBehavior, 99 Polymer.IronFormElementBehavior,
100 Polymer.IronValidatableBehavior, 100 Polymer.IronValidatableBehavior,
101 Polymer.IronCheckedElementBehaviorImpl 101 Polymer.IronCheckedElementBehaviorImpl
102 ]; 102 ];
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698