Remove all usage on POLYMER2

code base is on polymer 2 already

Change-Id: Ic5c9e3181c972fb5baeab3d870276005a7e9fcf0
(cherry picked from commit 34486c286e)
This commit is contained in:
Tao Zhou
2019-11-04 11:03:23 +01:00
committed by Paladox
parent 750f518e92
commit 2f06b47620
12 changed files with 5 additions and 25 deletions

View File

@@ -369,7 +369,6 @@
},
_getListItems() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this.root).querySelectorAll('gr-change-list-item'));
},

View File

@@ -332,7 +332,6 @@
},
get diffs() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this.root).querySelectorAll('gr-diff-host'));
},
@@ -926,7 +925,6 @@
_filesChanged() {
if (this._files && this._files.length > 0) {
Polymer.dom.flush();
// Polymer2: querySelectorAll returns NodeList instead of Array.
const files = Array.from(
Polymer.dom(this.root).querySelectorAll('.file-row'));
this.$.fileCursor.stops = files;

View File

@@ -422,7 +422,6 @@
* @return {!Array<!HTMLElement>}
*/
getThreadEls() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this.$.diff).querySelectorAll('.comment-thread'));
},

View File

@@ -73,8 +73,6 @@
},
_handleDownOnRangeComment(node) {
// Keep the original behavior in polymer 1
if (!window.POLYMER2) return false;
if (node &&
node.nodeName &&
node.nodeName.toLowerCase() === 'gr-comment-thread') {
@@ -183,13 +181,10 @@
* For Polymer 2, use shadowRoot.getSelection instead.
*/
_getSelection() {
let selection;
if (window.POLYMER2) {
const diffHost = util.querySelector(document.body, 'gr-diff');
selection = diffHost &&
diffHost.shadowRoot &&
diffHost.shadowRoot.getSelection();
}
const diffHost = util.querySelector(document.body, 'gr-diff');
const selection = diffHost &&
diffHost.shadowRoot &&
diffHost.shadowRoot.getSelection();
return selection ? selection: window.getSelection();
},

View File

@@ -436,7 +436,6 @@
return [];
}
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this.root).querySelectorAll('.diff-row'));
},

View File

@@ -169,10 +169,7 @@
dialog.querySelectorAll('gr-autocomplete')
.forEach(input => { input.text = ''; });
// TODO: reveiw binding for input after drop Polymer 1 support
// All docs related to Polymer 2 set binding only for iron-input,
// and doesn't add binding to input.
dialog.querySelectorAll(window.POLYMER2 ? 'iron-input' : 'input')
dialog.querySelectorAll('iron-input')
.forEach(input => { input.bindValue = ''; });
}

View File

@@ -74,7 +74,6 @@
},
_getEndpointParams() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this).querySelectorAll('gr-endpoint-param'));
},

View File

@@ -41,7 +41,6 @@
* @return {!Array<string>}
*/
_getDisplayedColumns() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(Polymer.dom(this.root)
.querySelectorAll('.checkboxContainer input:not([name=number])'))
.filter(checkbox => checkbox.checked)

View File

@@ -119,7 +119,6 @@
},
get accountChips() {
// Polymer2: querySelectorAll returns NodeList instead of Array.
return Array.from(
Polymer.dom(this.root).querySelectorAll('gr-account-chip'));
},

View File

@@ -161,7 +161,6 @@
if (this.suggestions.length > 0) {
if (!this.isHidden) {
Polymer.dom.flush();
// Polymer2: querySelectorAll returns NodeList instead of Array.
this._suggestionEls = Array.from(
this.$.suggestions.querySelectorAll('li'));
this._resetCursorIndex();

View File

@@ -20,7 +20,6 @@ limitations under the License.
href="/bower_components/polymer-resin/standalone/polymer-resin.html" />
<link rel="import" href="../behaviors/safe-types-behavior/safe-types-behavior.html">
<script>
window.POLYMER2 = true;
security.polymer_resin.install({
allowedIdentifierPrefixes: [''],
reportHandler(isViolation, fmt, ...args) {

View File

@@ -15,8 +15,6 @@
* limitations under the License.
*/
window.POLYMER2 = true;
/**
* Helps looking up the proper iron-input element during the Polymer 2
* transition. Polymer 2 uses the <iron-input> element, while Polymer 1 uses