Refactor use of startsWith into indexOf === 0 The `String#startsWith` method is not supported in IE, but its behavior can be replicated by testing whether the index of a string is equal to zero. Replace instances of `startsWith` with such `indexOf` usages. Change-Id: I37b5831900ff836545e224ac2f715b26ca694bbf
diff --git a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js index 32dd687..9c0e902 100644 --- a/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js +++ b/polygerrit-ui/app/elements/core/gr-reporting/gr-reporting.js
@@ -111,7 +111,7 @@ locationChanged: function() { var page = ''; var pathname = this._getPathname(); - if (pathname.startsWith('/q/')) { + if (pathname.indexOf('/q/') === 0) { page = '/q/'; } else if (pathname.match(CHANGE_VIEW_REGEX)) { // change view page = '/c/';
diff --git a/polygerrit-ui/app/elements/gr-app.js b/polygerrit-ui/app/elements/gr-app.js index 8ac268e..a188ea1 100644 --- a/polygerrit-ui/app/elements/gr-app.js +++ b/polygerrit-ui/app/elements/gr-app.js
@@ -166,7 +166,7 @@ _handleLocationChange: function(e) { var hash = e.detail.hash.substring(1); var pathname = e.detail.pathname; - if (pathname.startsWith('/c/') && parseInt(hash, 10) > 0) { + if (pathname.indexOf('/c/') === 0 && parseInt(hash, 10) > 0) { pathname += '@' + hash; } this.set('_path', pathname);