diff --git a/bower.json b/bower.json index b9fa52d..3509a80 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "domurl", - "version": "2.3.3", + "version": "2.3.4", "license": "MIT", "main": "url.min.js", "ignore": [ diff --git a/url.js b/url.js index b8f833f..6490e18 100644 --- a/url.js +++ b/url.js @@ -63,7 +63,8 @@ var isNode = typeof window === 'undefined' && typeof global !== 'undefined' && typeof require === 'function'; - var isIe = !isNode && ~ns.navigator.userAgent.indexOf('MSIE'); + var isIe = !isNode && ns.navigator && ns.navigator.userAgent && + ~ns.navigator.userAgent.indexOf('MSIE'); // Trick to bypass Webpack's require at compile time var nodeRequire = isNode ? ns['require'] : null; diff --git a/url.min.js b/url.min.js index 0ae8b8a..61abde5 100644 --- a/url.min.js +++ b/url.min.js @@ -1 +1 @@ -!function(t){"use strict";var y=/^[a-z]+:/,d=/[-a-z0-9]+(\.[-a-z0-9])*:\d+/i,v=/\/\/(.*?)(?::(.*?))?@/,r=/^win/i,g=/:$/,m=/^\?/,q=/^#/,w=/(.*\/)/,A=/^\/{2,}/,I=/(^\/?)/,e=/'/g,o=/%([ef][0-9a-f])%([89ab][0-9a-f])%([89ab][0-9a-f])/gi,n=/%([cd][0-9a-f])%([89ab][0-9a-f])/gi,i=/%([0-7][0-9a-f])/gi,a=/\+/g,s=/^\w:$/,C=/[^/#?]/;var p,S="undefined"==typeof window&&"undefined"!=typeof global&&"function"==typeof require,b=!S&&~t.navigator.userAgent.indexOf("MSIE"),x=S?t.require:null,j={protocol:"protocol",host:"hostname",port:"port",path:"pathname",query:"search",hash:"hash"},z={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443};function E(){return S?p=p||"file://"+(process.platform.match(r)?"/":"")+x("fs").realpathSync("."):"about:srcdoc"===document.location.href?self.parent.document.location.href:document.location.href}function h(t,r,e){var o,n,i;r=r||E(),S?o=x("url").parse(r):(o=document.createElement("a")).href=r;var s,a,p=(a={path:!0,query:!0,hash:!0},(s=r)&&y.test(s)&&(a.protocol=!0,a.host=!0,d.test(s)&&(a.port=!0),v.test(s)&&(a.user=!0,a.pass=!0)),a);for(n in i=r.match(v)||[],j)p[n]?t[n]=o[j[n]]||"":t[n]="";if(t.protocol=t.protocol.replace(g,""),t.query=t.query.replace(m,""),t.hash=F(t.hash.replace(q,"")),t.user=F(i[1]||""),t.pass=F(i[2]||""),t.port=z[t.protocol]==t.port||0==t.port?"":t.port,!p.protocol&&C.test(r.charAt(0))&&(t.path=r.split("?")[0].split("#")[0]),!p.protocol&&e){var h=new L(E().match(w)[0]),u=h.path.split("/"),c=t.path.split("/"),f=["protocol","user","pass","host","port"],l=f.length;for(u.pop(),n=0;n