| 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';
|
| }
|
| });
|
|
|