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

Side by Side Diff: third_party/polymer/v0_8/components-chromium/paper-checkbox/paper-checkbox-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, 6 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 Polymer({ 2 Polymer({
3 is: 'paper-checkbox', 3 is: 'paper-checkbox',
4 4
5 // The custom properties shim is currently an opt-in feature. 5 behaviors: [
6 enableCustomStyleProperties: true, 6 Polymer.PaperRadioButtonBehavior
7 ],
7 8
8 behaviors: [ 9 hostAttributes: {
9 Polymer.PaperRadioButtonBehavior 10 role: 'checkbox',
10 ], 11 'aria-checked': false,
11 12 tabindex: 0
12 hostAttributes: {
13 role: 'checkbox',
14 'aria-checked': false,
15 tabindex: 0
16 },
17
18 properties: {
19 /**
20 * Fired when the checked state changes due to user interaction.
21 *
22 * @event change
23 */
24
25 /**
26 * Fired when the checked state changes.
27 *
28 * @event iron-change
29 */
30
31 /**
32 * Gets or sets the state, `true` is checked and `false` is unchecked.
33 *
34 * @attribute checked
35 * @type boolean
36 * @default false
37 */
38 checked: {
39 type: Boolean,
40 value: false,
41 reflectToAttribute: true,
42 notify: true,
43 observer: '_checkedChanged'
44 }, 13 },
45 14
46 /** 15 properties: {
47 * If true, the user cannot interact with this element. 16 /**
48 * 17 * Fired when the checked state changes due to user interaction.
49 * @attribute disabled 18 *
50 * @type boolean 19 * @event change
51 * @default false 20 */
52 */ 21
53 disabled: { 22 /**
54 type: Boolean 23 * Fired when the checked state changes.
24 *
25 * @event iron-change
26 */
27
28 /**
29 * Gets or sets the state, `true` is checked and `false` is unchecked.
30 */
31 checked: {
32 type: Boolean,
33 value: false,
34 reflectToAttribute: true,
35 notify: true,
36 observer: '_checkedChanged'
37 },
38
39 /**
40 * If true, the button toggles the active state with each tap or press
41 * of the spacebar.
42 */
43 toggles: {
44 type: Boolean,
45 value: true,
46 reflectToAttribute: true
47 }
48 },
49
50 ready: function() {
51 if (Polymer.dom(this).textContent == '') {
52 this.$.checkboxLabel.hidden = true;
53 } else {
54 this.setAttribute('aria-label', Polymer.dom(this).textContent);
55 }
56 this._isReady = true;
57 },
58
59 // button-behavior hook
60 _buttonStateChanged: function() {
61 if (this.disabled) {
62 return;
63 }
64 if (this._isReady) {
65 this.checked = this.active;
66 }
67 },
68
69 _checkedChanged: function(checked) {
70 this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
71 this.active = this.checked;
72 this.fire('iron-change');
73 },
74
75 _computeCheckboxClass: function(checked) {
76 if (checked) {
77 return 'checked';
78 }
79 },
80
81 _computeCheckmarkClass: function(checked) {
82 if (!checked) {
83 return 'hidden';
84 }
55 } 85 }
56 }, 86 })
57 87
58 ready: function() {
59 this.toggles = true;
60
61 if (this.$.checkboxLabel.textContent == '') {
62 this.$.checkboxLabel.hidden = true;
63 } else {
64 this.setAttribute('aria-label', this.$.checkboxLabel.textContent);
65 }
66 },
67
68 // button-behavior hook
69 _buttonStateChanged: function() {
70 this.checked = this.active;
71 },
72
73 _checkedChanged: function(checked) {
74 this.setAttribute('aria-checked', this.checked ? 'true' : 'false');
75 this.active = this.checked;
76 this.fire('iron-change');
77 },
78
79 _computeCheckboxClass: function(checked) {
80 if (checked) {
81 return 'checked';
82 }
83 },
84
85 _computeCheckmarkClass: function(checked) {
86 if (!checked) {
87 return 'hidden';
88 }
89 }
90 })
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698