Index: tracing/tracing/ui/base/list_view.html |
diff --git a/tracing/tracing/ui/base/list_view.html b/tracing/tracing/ui/base/list_view.html |
index c7f927f32b34e97dc96f666ed4eb84371803bca5..0f69b3e01583b5ae4d3930613f16e3b89ee3d5a0 100644 |
--- a/tracing/tracing/ui/base/list_view.html |
+++ b/tracing/tracing/ui/base/list_view.html |
@@ -51,16 +51,19 @@ tr.exportTo('tr.ui.b', function() { |
configurable: true, |
set: function(value) { |
var oldSelection = listView.selectedElement; |
- if (oldSelection && oldSelection !== this && value) |
+ if (oldSelection && oldSelection !== this && value) { |
Polymer.dom(listView.selectedElement).removeAttribute( |
'selected'); |
- if (value) |
+ } |
+ if (value) { |
Polymer.dom(this).setAttribute('selected', 'selected'); |
- else |
+ } else { |
Polymer.dom(this).removeAttribute('selected'); |
+ } |
var newSelection = listView.selectedElement; |
- if (newSelection !== oldSelection) |
+ if (newSelection !== oldSelection) { |
tr.b.dispatchSimpleEvent(listView, 'selection-changed', false); |
+ } |
}, |
get: function() { |
return this.hasAttribute('selected'); |
@@ -81,27 +84,29 @@ tr.exportTo('tr.ui.b', function() { |
}, |
doneDecoratingForNow_: function() { |
- if (this.selectionChanged_) |
+ if (this.selectionChanged_) { |
tr.b.dispatchSimpleEvent(this, 'selection-changed', false); |
+ } |
}, |
get selectedElement() { |
var el = Polymer.dom(this).querySelector('.list-item[selected]'); |
- if (!el) |
- return undefined; |
+ if (!el) return undefined; |
return el; |
}, |
set selectedElement(el) { |
if (!el) { |
- if (this.selectedElement) |
+ if (this.selectedElement) { |
this.selectedElement.selected = false; |
+ } |
return; |
} |
- if (el.parentElement !== this) |
+ if (el.parentElement !== this) { |
throw new Error( |
'Can only select elements that are children of this list view'); |
+ } |
el.selected = true; |
}, |
@@ -113,25 +118,28 @@ tr.exportTo('tr.ui.b', function() { |
clear: function() { |
var changed = this.selectedElement !== undefined; |
tr.ui.b.ContainerThatDecoratesItsChildren.prototype.clear.call(this); |
- if (changed) |
+ if (changed) { |
tr.b.dispatchSimpleEvent(this, 'selection-changed', false); |
+ } |
}, |
onItemClicked_: function(e) { |
var currentSelectedElement = this.selectedElement; |
- if (currentSelectedElement) |
+ if (currentSelectedElement) { |
Polymer.dom(currentSelectedElement).removeAttribute('selected'); |
+ } |
var element = e.target; |
- while (element.parentElement !== this) |
+ while (element.parentElement !== this) { |
element = element.parentElement; |
- if (element !== currentSelectedElement) |
+ } |
+ if (element !== currentSelectedElement) { |
Polymer.dom(element).setAttribute('selected', 'selected'); |
+ } |
tr.b.dispatchSimpleEvent(this, 'selection-changed', false); |
}, |
onKeyDown_: function(e) { |
- if (this.selectedElement === undefined) |
- return; |
+ if (this.selectedElement === undefined) return; |
if (e.keyCode === 38) { // Up arrow. |
var prev = Polymer.dom(this.selectedElement).previousSibling; |