diff options
author | Steffen Rauh <steffen.rauh@gmx.de> | 2016-11-17 13:05:32 +0100 |
---|---|---|
committer | Steffen Rauh <steffen.rauh@gmx.de> | 2016-12-03 22:40:18 +0100 |
commit | 0966c6d2c674f288be3f1adf576a2fa2aada3691 (patch) | |
tree | aebe3209d3537154df58a9fe54d39a6632abd895 /app/assets/javascripts | |
parent | 0819d093e9b4aa9d5af1f6bdde147462f0c7cb48 (diff) | |
download | gitlab-ce-0966c6d2c674f288be3f1adf576a2fa2aada3691.tar.gz |
Fix compatibility with Internet Explorer 11 for merge requests
Diffstat (limited to 'app/assets/javascripts')
-rw-r--r-- | app/assets/javascripts/lib/utils/common_utils.js | 13 | ||||
-rw-r--r-- | app/assets/javascripts/merge_request_tabs.js.es6 | 5 |
2 files changed, 15 insertions, 3 deletions
diff --git a/app/assets/javascripts/lib/utils/common_utils.js b/app/assets/javascripts/lib/utils/common_utils.js index 29cba1a49dd..8fa80502d92 100644 --- a/app/assets/javascripts/lib/utils/common_utils.js +++ b/app/assets/javascripts/lib/utils/common_utils.js @@ -97,6 +97,19 @@ return $('body').data('page').split(':')[0]; }; + gl.utils.parseUrl = function (url) { + var parser = document.createElement('a'); + parser.href = url; + return parser; + }; + + gl.utils.parseUrlPathname = function (url) { + var parsedUrl = gl.utils.parseUrl(url); + // parsedUrl.pathname will return an absolute path for Firefox and a relative path for IE11 + // We have to make sure we always have an absolute path. + return parsedUrl.pathname.charAt(0) === '/' ? parsedUrl.pathname : '/' + parsedUrl.pathname; + }; + gl.utils.isMetaKey = function(e) { return e.metaKey || e.ctrlKey || e.altKey || e.shiftKey; }; diff --git a/app/assets/javascripts/merge_request_tabs.js.es6 b/app/assets/javascripts/merge_request_tabs.js.es6 index 583fb9fc03d..771803edb7c 100644 --- a/app/assets/javascripts/merge_request_tabs.js.es6 +++ b/app/assets/javascripts/merge_request_tabs.js.es6 @@ -225,11 +225,10 @@ // We extract pathname for the current Changes tab anchor href // some pages like MergeRequestsController#new has query parameters on that anchor - const url = document.createElement('a'); - url.href = source; + var urlPathname = gl.utils.parseUrlPathname(source); this.ajaxGet({ - url: `${url.pathname}.json${location.search}`, + url: `${urlPathname}.json${location.search}`, success: (data) => { $('#diffs').html(data.html); |