diff options
Diffstat (limited to 'chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html')
-rw-r--r-- | chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html b/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html index c8279565620..c50c4637758 100644 --- a/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html +++ b/chromium/third_party/catapult/tracing/tracing/ui/base/list_view.html @@ -31,7 +31,7 @@ tr.exportTo('tr.ui.b', function() { decorate: function() { tr.ui.b.ContainerThatDecoratesItsChildren.prototype.decorate.call(this); - this.classList.add('x-list-view'); + Polymer.dom(this).classList.add('x-list-view'); this.onItemClicked_ = this.onItemClicked_.bind(this); this.onKeyDown_ = this.onKeyDown_.bind(this); this.tabIndex = 0; @@ -41,7 +41,7 @@ tr.exportTo('tr.ui.b', function() { }, decorateChild_: function(item) { - item.classList.add('list-item'); + Polymer.dom(item).classList.add('list-item'); item.addEventListener('click', this.onItemClicked_, true); var listView = this; @@ -51,14 +51,15 @@ tr.exportTo('tr.ui.b', function() { configurable: true, set: function(value) { var oldSelection = listView.selectedElement; - if (oldSelection && oldSelection != this && value) - listView.selectedElement.removeAttribute('selected'); + if (oldSelection && oldSelection !== this && value) + Polymer.dom(listView.selectedElement).removeAttribute( + 'selected'); if (value) - this.setAttribute('selected', 'selected'); + Polymer.dom(this).setAttribute('selected', 'selected'); else - this.removeAttribute('selected'); + Polymer.dom(this).removeAttribute('selected'); var newSelection = listView.selectedElement; - if (newSelection != oldSelection) + if (newSelection !== oldSelection) tr.b.dispatchSimpleEvent(listView, 'selection-changed', false); }, get: function() { @@ -70,7 +71,7 @@ tr.exportTo('tr.ui.b', function() { undecorateChild_: function(item) { this.selectionChanged_ |= item.selected; - item.classList.remove('list-item'); + Polymer.dom(item).classList.remove('list-item'); item.removeEventListener('click', this.onItemClicked_); delete item.selected; }, @@ -85,7 +86,7 @@ tr.exportTo('tr.ui.b', function() { }, get selectedElement() { - var el = this.querySelector('.list-item[selected]'); + var el = Polymer.dom(this).querySelector('.list-item[selected]'); if (!el) return undefined; return el; @@ -98,14 +99,15 @@ tr.exportTo('tr.ui.b', function() { 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; }, getElementByIndex: function(index) { - return this.querySelector('.list-item:nth-child(' + index + ')'); + return Polymer.dom(this) + .querySelector('.list-item:nth-child(' + index + ')'); }, clear: function() { @@ -118,12 +120,12 @@ tr.exportTo('tr.ui.b', function() { onItemClicked_: function(e) { var currentSelectedElement = this.selectedElement; if (currentSelectedElement) - currentSelectedElement.removeAttribute('selected'); + Polymer.dom(currentSelectedElement).removeAttribute('selected'); var element = e.target; - while (element.parentElement != this) + while (element.parentElement !== this) element = element.parentElement; if (element !== currentSelectedElement) - element.setAttribute('selected', 'selected'); + Polymer.dom(element).setAttribute('selected', 'selected'); tr.b.dispatchSimpleEvent(this, 'selection-changed', false); }, @@ -131,16 +133,16 @@ tr.exportTo('tr.ui.b', function() { if (this.selectedElement === undefined) return; - if (e.keyCode == 38) { // Up arrow. - var prev = this.selectedElement.previousSibling; + if (e.keyCode === 38) { // Up arrow. + var prev = Polymer.dom(this.selectedElement).previousSibling; if (prev) { prev.selected = true; tr.ui.b.scrollIntoViewIfNeeded(prev); e.preventDefault(); return true; } - } else if (e.keyCode == 40) { // Down arrow. - var next = this.selectedElement.nextSibling; + } else if (e.keyCode === 40) { // Down arrow. + var next = Polymer.dom(this.selectedElement).nextSibling; if (next) { next.selected = true; tr.ui.b.scrollIntoViewIfNeeded(next); @@ -152,8 +154,8 @@ tr.exportTo('tr.ui.b', function() { addItem: function(textContent) { var item = document.createElement('div'); - item.textContent = textContent; - this.appendChild(item); + Polymer.dom(item).textContent = textContent; + Polymer.dom(this).appendChild(item); return item; } |