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

Unified Diff: tracing/tracing/ui/base/list_view.html

Issue 2776653002: [ESLint] Fix violations when enabling curly rule in eslint. (Closed)
Patch Set: rebase Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tracing/tracing/ui/base/list_and_associated_view.html ('k') | tracing/tracing/ui/base/mouse_mode_icon.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « tracing/tracing/ui/base/list_and_associated_view.html ('k') | tracing/tracing/ui/base/mouse_mode_icon.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698