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 | |
| 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 | |
|
Dan Beam
2015/02/19 22:47:56
are we writing chrome JS or Polymer? does this ge
Jeremy Klein
2015/02/19 22:58:00
Yes this will be ignored when compiled. It is here
| |
| 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 | |
| 27 */ | |
| 28 checked: { | |
| 29 value: false, | |
| 30 reflect: true | |
|
Dan Beam
2015/02/19 22:47:56
nit: , (we don't care about IE and this lessens di
Oren Blasberg
2015/02/19 23:38:02
Ended up putting on one line.
| |
| 31 }, | |
| 32 | |
| 33 /** | |
| 34 * The label for the checkbox. | |
| 35 * | |
| 36 * @attribute label | |
| 37 * @type string | |
| 38 * @default '' | |
| 39 */ | |
| 40 label: '', | |
| 41 | |
| 42 /** | |
| 43 * If true, the user cannot interact with this element. | |
| 44 * | |
| 45 * @attribute disabled | |
| 46 * @type boolean | |
| 47 * @default false | |
| 48 */ | |
| 49 disabled: { | |
| 50 value: false, | |
| 51 reflect: true | |
|
Dan Beam
2015/02/19 22:47:56
nit: if we're gonna copy this {value: false, relec
Jeremy Klein
2015/02/19 22:58:00
I don't expect that we'll copy this a whole lot so
Dan Beam
2015/02/19 23:09:49
yes
Oren Blasberg
2015/02/19 23:38:02
Done.
| |
| 52 }, | |
| 53 }, | |
| 54 | |
| 55 toggle: function() { | |
|
Dan Beam
2015/02/19 22:47:56
nit: doc comment
Oren Blasberg
2015/02/19 23:38:02
Done.
| |
| 56 this.$.checkbox.toggle(); | |
| 57 }, | |
| 58 | |
|
Dan Beam
2015/02/19 22:47:56
same
Oren Blasberg
2015/02/19 23:38:02
Done.
| |
| 59 ready: function() { | |
| 60 this.$.events.forward(this.$.checkbox, ['change']); | |
| 61 }, | |
| 62 }); | |
| OLD | NEW |