src/js/misc.js
function(to) {
        if ((to instanceof URI) === false) {
            to = new URI(to);
        }

        if (this.isAbsolute()                                                      &&
            to.isAbsolute()                                                        &&
            this.host === to.host                                                  &&
            this.port === to.port                                                  &&
            (this.scheme === to.scheme || (this.isFilePath() && to.isFilePath()) ) &&
            (this.path.indexOf(to.path) === 0 && (to.path.length === this.path.length ||
                                                  (to.path.length === 1 && to.path[0] === '/') ||
                                                  this.path[to.path.length] ===  '/'     )))
        {
            return (to.path.length === 1 && to.path[0] === '/') ? this.path.substring(to.path.length)
                                                                : this.path.substring(to.path.length + 1);
        } else {
            return null;
        }
    }
function(to) {
        if ((to instanceof URI) === false) {
            to = new URI(to);
        }

        if (this.isAbsolute()                                                      &&
            to.isAbsolute()                                                        &&
            this.host === to.host                                                  &&
            this.port === to.port                                                  &&
            (this.scheme === to.scheme || (this.isFilePath() && to.isFilePath()) ) &&
            (this.path.indexOf(to.path) === 0 && (to.path.length === this.path.length ||
                                                  (to.path.length === 1 && to.path[0] === '/') ||
                                                  this.path[to.path.length] ===  '/'     )))
        {
            return (to.path.length === 1 && to.path[0] === '/') ? this.path.substring(to.path.length)
                                                                : this.path.substring(to.path.length + 1);
        } else {
            return null;
        }
    }
function ( to ) { if ( ( to instanceof URI ) === false ) { to = new URI ( to ) ; } if ( this . isAbsolute ( ) && to . isAbsolute ( ) && this . host === to . host && this . port === to . port && ( this . scheme === to . scheme || ( this . isFilePath ( ) && to . isFilePath ( ) ) ) && ( this . path . indexOf ( to . path ) === 0 && ( to . path . length === this . path . length || ( to . path . length === 1 && to . path [ 0 ] === '/' ) || this . path [ to . path . length ] === '/' ) ) ) { return ( to . path . length === 1 && to . path [ 0 ] === '/' ) ? this . path . substring ( to . path . length ) : this . path . substring ( to . path . length + 1 ) ; } else { return null ; } }
Get an URI relative to the given URI.
@param  {String|zebkit.URI} to an URI to that the relative URI has to be detected.
@return {String} a relative URI
@method relative
Get an URI relative to the given URI .