Polymer 2: Make sure that querySelectorAll works with NodeList https://polymer-library.polymer-project.org/2.0/docs/upgrade#polymer-dom-apis Change-Id: Id6dd6fbbdb5a9494485b6c6f5361d12306cd052c
diff --git a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js index 765b49d..8c6536a 100644 --- a/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js +++ b/polygerrit-ui/app/elements/change-list/gr-change-list/gr-change-list.js
@@ -351,7 +351,9 @@ }, _getListItems() { - return Polymer.dom(this.root).querySelectorAll('gr-change-list-item'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this.root).querySelectorAll('gr-change-list-item')); }, _sectionsChanged() {
diff --git a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js index 950c1e8..cf2f0e5 100644 --- a/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js +++ b/polygerrit-ui/app/elements/change/gr-account-list/gr-account-list.js
@@ -88,7 +88,9 @@ }, get accountChips() { - return Polymer.dom(this.root).querySelectorAll('gr-account-chip'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this.root).querySelectorAll('gr-account-chip')); }, get focusStart() {
diff --git a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js index 460512a..134920b 100644 --- a/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js +++ b/polygerrit-ui/app/elements/change/gr-file-list/gr-file-list.js
@@ -291,7 +291,9 @@ }, get diffs() { - return Polymer.dom(this.root).querySelectorAll('gr-diff-host'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this.root).querySelectorAll('gr-diff-host')); }, openDiffPrefs() { @@ -858,7 +860,9 @@ _filesChanged() { Polymer.dom.flush(); - const files = Polymer.dom(this.root).querySelectorAll('.file-row'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + const files = Array.from( + Polymer.dom(this.root).querySelectorAll('.file-row')); this.$.fileCursor.stops = files; this.$.fileCursor.setCursorAtIndex(this.selectedIndex, true); },
diff --git a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js index 65c8233..9e6314dd 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js +++ b/polygerrit-ui/app/elements/diff/gr-diff-host/gr-diff-host.js
@@ -340,7 +340,9 @@ * @return {!Array<!HTMLElement>} */ getThreadEls() { - return Polymer.dom(this.$.diff).querySelectorAll('.comment-thread'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this.$.diff).querySelectorAll('.comment-thread')); }, /** @param {HTMLElement} el */
diff --git a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js index 2146d9d..045a8e3 100644 --- a/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js +++ b/polygerrit-ui/app/elements/diff/gr-diff/gr-diff.js
@@ -406,7 +406,9 @@ return []; } - return Polymer.dom(this.root).querySelectorAll('.diff-row'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this.root).querySelectorAll('.diff-row')); }, /** @return {boolean} */
diff --git a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js index fe82f2b..96bcd5c 100644 --- a/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js +++ b/polygerrit-ui/app/elements/plugins/gr-endpoint-decorator/gr-endpoint-decorator.js
@@ -71,7 +71,9 @@ }, _getEndpointParams() { - return Polymer.dom(this).querySelectorAll('gr-endpoint-param'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from( + Polymer.dom(this).querySelectorAll('gr-endpoint-param')); }, /**
diff --git a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js index 7d109633..43afdf8 100644 --- a/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js +++ b/polygerrit-ui/app/elements/settings/gr-change-table-editor/gr-change-table-editor.js
@@ -41,8 +41,9 @@ * @return {!Array<string>} */ _getDisplayedColumns() { - return Polymer.dom(this.root) - .querySelectorAll('.checkboxContainer input:not([name=number])') + // Polymer2: querySelectorAll returns NodeList instead of Array. + return Array.from(Polymer.dom(this.root) + .querySelectorAll('.checkboxContainer input:not([name=number])')) .filter(checkbox => checkbox.checked) .map(checkbox => checkbox.name); },
diff --git a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js index 2e55010..fb2c182 100644 --- a/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js +++ b/polygerrit-ui/app/elements/shared/gr-autocomplete-dropdown/gr-autocomplete-dropdown.js
@@ -162,7 +162,9 @@ _resetCursorStops() { if (this.suggestions.length > 0) { Polymer.dom.flush(); - this._suggestionEls = this.$.suggestions.querySelectorAll('li'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + this._suggestionEls = Array.from( + this.$.suggestions.querySelectorAll('li')); } else { this._suggestionEls = []; }
diff --git a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js index 3d9d36b..969272f 100644 --- a/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js +++ b/polygerrit-ui/app/elements/shared/gr-dropdown/gr-dropdown.js
@@ -280,7 +280,9 @@ */ _resetCursorStops() { Polymer.dom.flush(); - this._listElements = Polymer.dom(this.root).querySelectorAll('li'); + // Polymer2: querySelectorAll returns NodeList instead of Array. + this._listElements = Array.from( + Polymer.dom(this.root).querySelectorAll('li')); }, _computeHasTooltip(tooltip) {