| Index: tracing/tracing/ui/base/radio_picker.html
|
| diff --git a/tracing/tracing/ui/base/radio_picker.html b/tracing/tracing/ui/base/radio_picker.html
|
| index 90edfc9a675542db12fd6b4827790196d41de22c..c19f213c46a5104b8eacdb0968391f217abf275b 100644
|
| --- a/tracing/tracing/ui/base/radio_picker.html
|
| +++ b/tracing/tracing/ui/base/radio_picker.html
|
| @@ -55,10 +55,11 @@ Polymer({
|
| },
|
|
|
| set vertical(vertical) {
|
| - if (vertical)
|
| + if (vertical) {
|
| this.setAttribute('vertical', true);
|
| - else
|
| + } else {
|
| this.removeAttribute('vertical');
|
| + }
|
| },
|
|
|
| get settingsKey() {
|
| @@ -66,17 +67,16 @@ Polymer({
|
| },
|
|
|
| set settingsKey(settingsKey) {
|
| - if (!this.needsInit_)
|
| + if (!this.needsInit_) {
|
| throw new Error('Already initialized.');
|
| + }
|
| this.settingsKey_ = settingsKey;
|
| this.maybeInit_();
|
| },
|
|
|
| maybeInit_: function() {
|
| - if (!this.needsInit_)
|
| - return;
|
| - if (this.settingsKey_ === undefined)
|
| - return;
|
| + if (!this.needsInit_) return;
|
| + if (this.settingsKey_ === undefined) return;
|
| this.needsInit_ = false;
|
| this.select(tr.b.Settings.get(this.settingsKey_));
|
| },
|
| @@ -84,8 +84,9 @@ Polymer({
|
| set items(items) {
|
| this.radioButtons_ = {};
|
| items.forEach(function(e) {
|
| - if (e.key in this.radioButtons_)
|
| + if (e.key in this.radioButtons_) {
|
| throw new Error(e.key + ' already exists');
|
| + }
|
| var radioButton = document.createElement('div');
|
| var input = document.createElement('input');
|
| var label = document.createElement('label');
|
| @@ -107,33 +108,37 @@ Polymer({
|
| },
|
|
|
| maybeRenderRadioButtons_: function() {
|
| - if (!this.isReady_)
|
| - return;
|
| - if (this.radioButtons_ === undefined)
|
| - return;
|
| - for (var key in this.radioButtons_)
|
| + if (!this.isReady_) return;
|
| + if (this.radioButtons_ === undefined) return;
|
| + for (var key in this.radioButtons_) {
|
| Polymer.dom(this.$.container).appendChild(
|
| this.radioButtons_[key].parentElement);
|
| - if (this.selectedKey_ !== undefined)
|
| + }
|
| + if (this.selectedKey_ !== undefined) {
|
| this.select(this.selectedKey_);
|
| + }
|
| },
|
|
|
| select: function(key) {
|
| - if (key === undefined || key === this.selectedKey_)
|
| + if (key === undefined || key === this.selectedKey_) {
|
| return;
|
| + }
|
| if (this.radioButtons_ === undefined) {
|
| this.selectedKey_ = key;
|
| return;
|
| }
|
| - if (!(key in this.radioButtons_))
|
| + if (!(key in this.radioButtons_)) {
|
| throw new Error(key + ' does not exists');
|
| + }
|
| // Unselect the previous radio, update the key & select the new one.
|
| - if (this.selectedKey_ !== undefined)
|
| + if (this.selectedKey_ !== undefined) {
|
| this.radioButtons_[this.selectedKey_].checked = false;
|
| + }
|
| this.selectedKey_ = key;
|
| tr.b.Settings.set(this.settingsKey_, this.selectedKey_);
|
| - if (this.selectedKey_ !== undefined)
|
| + if (this.selectedKey_ !== undefined) {
|
| this.radioButtons_[this.selectedKey_].checked = true;
|
| + }
|
|
|
| this.dispatchEvent(new tr.b.Event('change', false));
|
| },
|
|
|