Merge pull request #597 from oneru/master

Handle missing leading slash in elem.pathname
This commit is contained in:
Solly Ross 2016-04-12 17:32:43 -04:00
commit bf0ce0ba3c
1 changed files with 6 additions and 1 deletions

View File

@ -282,5 +282,10 @@ WebUtil.injectParamIfMissing = function (path, param, value) {
elem.search = "?" + query.join("&"); elem.search = "?" + query.join("&");
} }
return elem.pathname.slice(1) + elem.search + elem.hash; // some browsers (e.g. IE11) may occasionally omit the leading slash
// in the elem.pathname string. Handle that case gracefully.
if (elem.pathname.charAt(0) == "/") {
return elem.pathname.slice(1) + elem.search + elem.hash;
} else {
return elem.pathname + elem.search + elem.hash;
}; };