Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 /* Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 * Use of this source code is governed by a BSD-style license that can be | |
| 3 * found in the LICENSE file. */ | |
| 4 | |
| 5 /** | |
| 6 * @fileoverview | |
| 7 * `cr-checkbox` is a button that can be either checked or unchecked. User | |
|
Dan Beam
2015/02/13 21:56:50
nit: \s\s -> \s
michaelpg
2015/02/13 23:27:57
I'd encourage this to be more than a nit, as doubl
Oren Blasberg
2015/02/17 18:23:38
Done.
| |
| 8 * can tap the checkbox to check or uncheck it. Usually you use checkboxes | |
| 9 * to allow user to select multiple options from a set. If you have a single | |
| 10 * ON/OFF option, avoid using a single checkbox and use `cr-toggle-button` | |
| 11 * instead. | |
| 12 * | |
| 13 * Example: | |
| 14 * <cr-checkbox></cr-checkbox> | |
| 15 * <cr-checkbox checked></cr-checkbox> | |
| 16 * | |
| 17 * @element cr-checkbox | |
| 18 */ | |
| 19 Polymer({ | |
| 20 publish: { | |
| 21 /** | |
| 22 * Gets or sets the state. `true` is checked and `false` is unchecked. | |
| 23 * | |
| 24 * @attribute checked | |
| 25 * @type boolean | |
| 26 * @default false | |
|
Dan Beam
2015/02/13 21:56:50
^ what syntax is this?
michaelpg
2015/02/14 05:51:17
Polymer-flavored jsdoc: https://www.polymer-projec
| |
| 27 */ | |
| 28 checked: { | |
| 29 value: false, | |
| 30 reflect: true | |
| 31 }, | |
| 32 | |
|
Dan Beam
2015/02/13 21:56:50
why so spacious?
Oren Blasberg
2015/02/17 18:23:38
Done.
| |
| 33 | |
| 34 /** | |
| 35 * The label for the checkbox. | |
| 36 * | |
| 37 * @attribute label | |
| 38 * @type string | |
| 39 * @default '' | |
| 40 */ | |
| 41 label: '', | |
| 42 | |
| 43 | |
| 44 /** | |
| 45 * If true, the user cannot interact with this element. | |
| 46 * | |
| 47 * @attribute disabled | |
| 48 * @type boolean | |
| 49 * @default false | |
| 50 */ | |
| 51 disabled: { | |
| 52 value: false, | |
| 53 reflect: true | |
| 54 }, | |
| 55 }, | |
| 56 | |
| 57 toggle: function() { | |
| 58 this.$.checkbox.toggle(); | |
| 59 }, | |
| 60 | |
| 61 ready: function() { | |
| 62 this.$.events.forward(this.$.checkbox, ['change']); | |
| 63 }, | |
| 64 }); | |
| OLD | NEW |