Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/thatcher/env-js
Browse files Browse the repository at this point in the history
  • Loading branch information
client9 committed Apr 2, 2010
2 parents b690d82 + 899869f commit 4235826
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 16 deletions.
9 changes: 8 additions & 1 deletion .gitignore
Expand Up @@ -8,4 +8,11 @@ htmlparser/gwt*
htmlparser/html5
htmlparser/build
local_settings.js
java_pid*
java_pid*

# gpsee compiled js files
*.jsc

# emacs turds
\#*

18 changes: 10 additions & 8 deletions src/common/urlparse.js
Expand Up @@ -124,7 +124,7 @@ urlparse.normalizepath = function(path)
path = '/';
}
return path;
}
};

//
// Does many of the normalizations that the stock
Expand Down Expand Up @@ -164,7 +164,7 @@ urlparse.urlnormalize = function(url)
parts.path = urlparse.normalizepath(parts.path);

return urlparse.urlunsplit(parts);
}
};

urlparse.urldefrag = function(url)
{
Expand All @@ -174,10 +174,12 @@ urlparse.urldefrag = function(url)
} else {
return [ url.substr(0,idx), url.substr(idx+1) ];
}
}
};

urlparse.urlsplit = function(url, default_scheme, allow_fragments)
{
var leftover;

if (typeof allow_fragments === 'undefined') {
allow_fragments = true;
}
Expand All @@ -202,12 +204,12 @@ urlparse.urlsplit = function(url, default_scheme, allow_fragments)
o.netloc += ':' + parts[4];
}

var leftover = parts[5];
leftover = parts[5];
} else {
o.scheme = default_scheme || '';
o.netloc = '';
o.hostname = '';
var leftover = url;
leftover = url;
}
o.scheme = o.scheme.toLowerCase();

Expand All @@ -223,7 +225,7 @@ urlparse.urlsplit = function(url, default_scheme, allow_fragments)
}

return o;
}
};

urlparse.urlunsplit = function(o) {
var s = '';
Expand Down Expand Up @@ -258,7 +260,7 @@ urlparse.urlunsplit = function(o) {
s += '#' + o.fragment;
}
return s;
}
};

urlparse.urljoin = function(base, url, allow_fragments)
{
Expand Down Expand Up @@ -324,4 +326,4 @@ urlparse.urljoin = function(base, url, allow_fragments)
}

return urlparse.urlunsplit(base_parts);
}
};
14 changes: 7 additions & 7 deletions src/window/base64.js
Expand Up @@ -69,7 +69,7 @@ base64.makeDOMException = function() {
ex.toString = function() { return 'Error: ' + ex.name + ': ' + ex.message; };
return ex;
}
}
};

base64.getbyte64 = function(s,i) {
// This is oddly fast, except on Chrome/V8.
Expand All @@ -80,14 +80,14 @@ base64.getbyte64 = function(s,i) {
throw base64.makeDOMException();
}
return idx;
}
};

base64.decode = function(s) {
// convert to string
s = '' + s;
var getbyte64 = base64.getbyte64;
var pads, i, b10;
var imax = s.length
var imax = s.length;
if (imax === 0) {
return s;
}
Expand All @@ -96,7 +96,7 @@ base64.decode = function(s) {
throw base64.makeDOMException();
}

pads = 0
pads = 0;
if (s.charAt(imax - 1) === base64.PADCHAR) {
pads = 1;
if (s.charAt(imax - 2) === base64.PADCHAR) {
Expand Down Expand Up @@ -124,15 +124,15 @@ base64.decode = function(s) {
break;
}
return x.join('');
}
};

base64.getbyte = function(s,i) {
var x = s.charCodeAt(i);
if (x > 255) {
throw base64.makeDOMException();
}
return x;
}
};

base64.encode = function(s) {
if (arguments.length !== 1) {
Expand Down Expand Up @@ -173,4 +173,4 @@ base64.encode = function(s) {
break;
}
return x.join('');
}
};

0 comments on commit 4235826

Please sign in to comment.