wip
This commit is contained in:
parent
e3b68cb572
commit
0a931a8242
|
@ -23,6 +23,8 @@ xrf.navigator.to = (url,flags,loader,data) => {
|
|||
URI.duplicatePos = URI.source == xrf.navigator.URI.source && URI.hasPos
|
||||
URI.hashChange = String(xrf.navigator.URI.fragment||"") != String(URI.fragment||"")
|
||||
let hashbus = xrf.hashbus
|
||||
console.dir({URI1:xrf.navigator.URI,URI2:URI})
|
||||
debugger
|
||||
xrf.navigator.URI = URI
|
||||
let {directory,file,fragment,fileExt} = URI;
|
||||
|
||||
|
|
|
@ -19,5 +19,6 @@
|
|||
{"fn":"url","data":"a/b#foo=bar", "expect":{ "fn":"testURL", "input":"hash.foo","out":"bar"},"label":"test URL hash #mycustom == foo"},
|
||||
{"fn":"url","data":"./../../xyz", "expect":{ "fn":"testURLBrowse", "input":"path","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"},
|
||||
{"fn":"url","data":"./../../xyz", "expect":{ "fn":"testURLBrowse", "input":"path","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"},
|
||||
{"fn":"url","data":"#foo", "expect":{ "fn":"testURLBrowse", "input":"directory","out":"/bar/flop/c/d/./../../xyz"},"label":"test URL relative path"},
|
||||
{"fn":"url","data":"a/b?index.glb#foo=bar://foo/flop.gltf", "expect":{ "fn":"testURL", "input":"directory","out":"/a/b"},"label":"test URLhash with protocol"}
|
||||
]
|
||||
|
|
|
@ -125,7 +125,7 @@ class URI {
|
|||
// The almighty regexp (courtesy of http://blog.stevenlevithan.com/archives/parseuri)
|
||||
var r : EReg = ~/^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/;
|
||||
|
||||
if( stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != '/' ){
|
||||
if( stringUrl.indexOf("://") == -1 && stringUrl.charAt(0) != '/' && stringUrl.charAt(0) != '#' ){
|
||||
stringUrl = "/" + stringUrl; // workaround for relative urls
|
||||
}
|
||||
|
||||
|
@ -431,7 +431,7 @@ class URI {
|
|||
directory = url.directory;
|
||||
}
|
||||
|
||||
if (newURI.directory != null)
|
||||
if (newURI.directory != null && newURI.source.charAt(0) != "#")
|
||||
{
|
||||
if( newUrl.charAt(0) != '/' && newUrl.indexOf("://") == -1 ){
|
||||
var stripRelative : EReg = ~/\.\/.*/;
|
||||
|
@ -443,13 +443,16 @@ class URI {
|
|||
}
|
||||
|
||||
resultURI.directory = directory;
|
||||
|
||||
|
||||
trace("1:"+newURI.file);
|
||||
trace("2:"+url.file);
|
||||
if (newURI.file != null)
|
||||
{
|
||||
resultURI.file = newURI.file;
|
||||
}else{
|
||||
resultURI.file = url.file;
|
||||
}
|
||||
trace("3:"+resultURI.file);
|
||||
|
||||
resultURI.path = resultURI.directory + resultURI.file;
|
||||
|
||||
|
|
Loading…
Reference in New Issue