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

Unified Diff: third_party/polymer/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js

Issue 1336623003: [MD settings] updating polymer to 1.1.13 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changed Polymer.IronCheckedElementBehavior name Created 5 years, 3 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/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js
diff --git a/third_party/polymer/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js b/third_party/polymer/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js
index fdf903a9662d7d54d6d535d3e6953831a8fd8519..e9219ee28d308560b0d0c0f795c1ea0b90bb9096 100644
--- a/third_party/polymer/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js
+++ b/third_party/polymer/v1_0/components-chromium/paper-checkbox/paper-checkbox-extracted.js
@@ -2,7 +2,8 @@ Polymer({
is: 'paper-checkbox',
behaviors: [
- Polymer.PaperInkyFocusBehavior
+ Polymer.PaperInkyFocusBehavior,
+ Polymer.IronCheckedElementBehavior
],
hostAttributes: {
@@ -23,39 +24,31 @@ Polymer({
*
* @event iron-change
*/
-
- /**
- * Gets or sets the state, `true` is checked and `false` is unchecked.
- */
- checked: {
- type: Boolean,
- value: false,
- reflectToAttribute: true,
- notify: true,
- observer: '_checkedChanged'
- },
-
- /**
- * If true, the button toggles the active state with each tap or press
- * of the spacebar.
- */
- toggles: {
- type: Boolean,
- value: true,
- reflectToAttribute: true
+ ariaActiveAttribute: {
+ type: String,
+ value: 'aria-checked'
}
},
attached: function() {
- var trimmedText = Polymer.dom(this).textContent.trim();
- if (trimmedText === '') {
- this.$.checkboxLabel.hidden = true;
- }
+ this._isReady = true;
+
// Don't stomp over a user-set aria-label.
- if (trimmedText !== '' && !this.getAttribute('aria-label')) {
- this.setAttribute('aria-label', trimmedText);
+ if (!this.getAttribute('aria-label')) {
+ this.updateAriaLabel();
}
- this._isReady = true;
+ },
+
+ /**
+ * Update the checkbox aria-label. This is a temporary workaround not
+ * being able to observe changes in <content>
+ * (see: https://github.com/Polymer/polymer/issues/1773)
+ *
+ * Call this if you manually change the contents of the checkbox
+ * and want the aria-label to match the new contents.
+ */
+ updateAriaLabel: function() {
+ this.setAttribute('aria-label', Polymer.dom(this).textContent.trim());
},
// button-behavior hook
@@ -68,23 +61,18 @@ Polymer({
}
},
- _checkedChanged: function(checked) {
- this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
- this.active = this.checked;
- this.fire('iron-change');
- },
-
- _computeCheckboxClass: function(checked) {
+ _computeCheckboxClass: function(checked, invalid) {
+ var className = '';
if (checked) {
- return 'checked';
+ className += 'checked ';
}
- return '';
+ if (invalid) {
+ className += 'invalid';
+ }
+ return className;
},
_computeCheckmarkClass: function(checked) {
- if (!checked) {
- return 'hidden';
- }
- return '';
+ return checked ? '' : 'hidden';
}
});

Powered by Google App Engine
This is Rietveld 408576698