Skip to content

Commit

Permalink
consolidating urlparse to single include, Envjs literal extends it so…
Browse files Browse the repository at this point in the history
… internally use Envjs.urlsplit instead of urlparse.urlsplit
  • Loading branch information
thatcher committed Apr 27, 2010
1 parent 521c6c8 commit f215d8c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions build.xml
Expand Up @@ -122,12 +122,13 @@
</filterchain>
<fileset dir="${SRC_DIR}" includes="platform/core/__global__.js" />
<fileset dir="${SRC_DIR}" includes="common/intro.js" />
<fileset dir="${SRC_DIR}" includes="common/urlparse.js" />
<fileset dir="${SRC_DIR}" includes="common/__extend__.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/console.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/dom.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/event.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/html.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/timer.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/urlparse.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/xhr.js" />
<fileset dir="${SRC_DIR}" includes="platform/core/window.js" />
<fileset dir="${SRC_DIR}" includes="common/outro.js" />
Expand Down Expand Up @@ -565,7 +566,6 @@
<fileset dir="${SRC_DIR}" includes="common/__extend__.js" />
<fileset dir="${SRC_DIR}" includes="common/__setArray__.js" />
<fileset dir="${SRC_DIR}" includes="common/__trim__.js" />
<fileset dir="${SRC_DIR}" includes="common/urlparse.js" />
<fileset dir="${SRC_DIR}" includes="xhr/document.js" />
<fileset dir="${SRC_DIR}" includes="xhr/form.js" />
<fileset dir="${SRC_DIR}" includes="xhr/location.js" />
Expand Down
4 changes: 4 additions & 0 deletions src/platform/core/xhr.js
Expand Up @@ -58,6 +58,7 @@ Envjs.uri = function(path, base) {
};



/**
* Used in the XMLHttpRquest implementation to run a
* request in a seperate thread
Expand Down Expand Up @@ -100,3 +101,6 @@ Envjs.deleteFile = function(url){};
* @param {Object} data
*/
Envjs.connection = function(xhr, responseHandler, data){};


__extend__(Envjs, urlparse);
20 changes: 10 additions & 10 deletions src/xhr/location.js
Expand Up @@ -26,7 +26,7 @@ Location = function(url, doc, history) {
$document = doc ? doc : null,
$history = history ? history : null;

var parts = urlparse.urlsplit($url);
var parts = Envjs.urlsplit($url);

return {
get hash() {
Expand All @@ -38,7 +38,7 @@ Location = function(url, doc, history) {
} else {
parts.fragment = s;
}
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'hash');
}
Expand All @@ -53,10 +53,10 @@ Location = function(url, doc, history) {
}

parts.netloc = s;
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);

// this regenerates hostname & port
parts = urlparse.urlsplit($url);
parts = Envjs.urlsplit($url);

if ($history) {
$history.add( $url, 'host');
Expand All @@ -77,7 +77,7 @@ Location = function(url, doc, history) {
parts.netloc += ':' + parts.port;
}
parts.hostname = s;
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add( $url, 'hostname');
}
Expand All @@ -104,7 +104,7 @@ Location = function(url, doc, history) {
} else {
parts.path = '/' + s;
}
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);

if ($history) {
$history.add($url, 'pathname');
Expand All @@ -121,7 +121,7 @@ Location = function(url, doc, history) {
var s = '' + p;
parts.port = s;
parts.netloc = parts.hostname + ':' + parts.port;
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add( $url, 'port');
}
Expand All @@ -137,7 +137,7 @@ Location = function(url, doc, history) {
s = s.substr(0,i);
}
parts.scheme = s;
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'protocol');
}
Expand All @@ -152,7 +152,7 @@ Location = function(url, doc, history) {
s = s.substr(1);
}
parts.query = s;
$url = urlparse.urlunsplit(parts);
$url = Envjs.urlunsplit(parts);
if ($history) {
$history.add($url, 'search');
}
Expand All @@ -173,7 +173,7 @@ Location = function(url, doc, history) {

// update closure upvars
$url = url;
parts = urlparse.urlsplit($url);
parts = Envjs.urlsplit($url);

//we can only assign if this Location is associated with a document
if ($document) {
Expand Down

0 comments on commit f215d8c

Please sign in to comment.