vendor/html-css-sanitizer-bundle.js
function resolve(baseUri, relativeUri) {
  // there are several kinds of relative urls:
  // 1. //foo - replaces everything from the domain on.  foo is a domain name
  // 2. foo - replaces the last part of the path, the whole query and fragment
  // 3. /foo - replaces the the path, the query and fragment
  // 4. ?foo - replace the query and fragment
  // 5. #foo - replace the fragment only

  var absoluteUri = baseUri.clone();
  // we satisfy these conditions by looking for the first part of relativeUri
  // that is not blank and applying defaults to the rest

  var overridden = relativeUri.hasScheme();

  if (overridden) {
    absoluteUri.setRawScheme(relativeUri.getRawScheme());
  } else {
    overridden = relativeUri.hasCredentials();
  }

  if (overridden) {
    absoluteUri.setRawCredentials(relativeUri.getRawCredentials());
  } else {
    overridden = relativeUri.hasDomain();
  }

  if (overridden) {
    absoluteUri.setRawDomain(relativeUri.getRawDomain());
  } else {
    overridden = relativeUri.hasPort();
  }

  var rawPath = relativeUri.getRawPath();
  var simplifiedPath = collapse_dots(rawPath);
  if (overridden) {
    absoluteUri.setPort(relativeUri.getPort());
    simplifiedPath = simplifiedPath
        && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
  } else {
    overridden = !!rawPath;
    if (overridden) {
      // resolve path properly
      if (simplifiedPath.charCodeAt(0) !== 0x2f /* / */) {  // path is relative
        var absRawPath = collapse_dots(absoluteUri.getRawPath() || '')
            .replace(EXTRA_PARENT_PATHS_RE, '');
        var slash = absRawPath.lastIndexOf('/') + 1;
        simplifiedPath = collapse_dots(
            (slash ? absRawPath.substring(0, slash) : '')
            + collapse_dots(rawPath))
            .replace(EXTRA_PARENT_PATHS_RE, '');
      }
    } else {
      simplifiedPath = simplifiedPath
          && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
      if (simplifiedPath !== rawPath) {
        absoluteUri.setRawPath(simplifiedPath);
      }
    }
  }

  if (overridden) {
    absoluteUri.setRawPath(simplifiedPath);
  } else {
    overridden = relativeUri.hasQuery();
  }

  if (overridden) {
    absoluteUri.setRawQuery(relativeUri.getRawQuery());
  } else {
    overridden = relativeUri.hasFragment();
  }

  if (overridden) {
    absoluteUri.setRawFragment(relativeUri.getRawFragment());
  }

  return absoluteUri;
}
function resolve(baseUri, relativeUri) {
  // there are several kinds of relative urls:
  // 1. //foo - replaces everything from the domain on.  foo is a domain name
  // 2. foo - replaces the last part of the path, the whole query and fragment
  // 3. /foo - replaces the the path, the query and fragment
  // 4. ?foo - replace the query and fragment
  // 5. #foo - replace the fragment only

  var absoluteUri = baseUri.clone();
  // we satisfy these conditions by looking for the first part of relativeUri
  // that is not blank and applying defaults to the rest

  var overridden = relativeUri.hasScheme();

  if (overridden) {
    absoluteUri.setRawScheme(relativeUri.getRawScheme());
  } else {
    overridden = relativeUri.hasCredentials();
  }

  if (overridden) {
    absoluteUri.setRawCredentials(relativeUri.getRawCredentials());
  } else {
    overridden = relativeUri.hasDomain();
  }

  if (overridden) {
    absoluteUri.setRawDomain(relativeUri.getRawDomain());
  } else {
    overridden = relativeUri.hasPort();
  }

  var rawPath = relativeUri.getRawPath();
  var simplifiedPath = collapse_dots(rawPath);
  if (overridden) {
    absoluteUri.setPort(relativeUri.getPort());
    simplifiedPath = simplifiedPath
        && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
  } else {
    overridden = !!rawPath;
    if (overridden) {
      // resolve path properly
      if (simplifiedPath.charCodeAt(0) !== 0x2f /* / */) {  // path is relative
        var absRawPath = collapse_dots(absoluteUri.getRawPath() || '')
            .replace(EXTRA_PARENT_PATHS_RE, '');
        var slash = absRawPath.lastIndexOf('/') + 1;
        simplifiedPath = collapse_dots(
            (slash ? absRawPath.substring(0, slash) : '')
            + collapse_dots(rawPath))
            .replace(EXTRA_PARENT_PATHS_RE, '');
      }
    } else {
      simplifiedPath = simplifiedPath
          && simplifiedPath.replace(EXTRA_PARENT_PATHS_RE, '');
      if (simplifiedPath !== rawPath) {
        absoluteUri.setRawPath(simplifiedPath);
      }
    }
  }

  if (overridden) {
    absoluteUri.setRawPath(simplifiedPath);
  } else {
    overridden = relativeUri.hasQuery();
  }

  if (overridden) {
    absoluteUri.setRawQuery(relativeUri.getRawQuery());
  } else {
    overridden = relativeUri.hasFragment();
  }

  if (overridden) {
    absoluteUri.setRawFragment(relativeUri.getRawFragment());
  }

  return absoluteUri;
}
function resolve ( baseUri , relativeUri ) { // there are several kinds of relative urls: // 1. //foo - replaces everything from the domain on.  foo is a domain name // 2. foo - replaces the last part of the path, the whole query and fragment // 3. /foo - replaces the the path, the query and fragment // 4. ?foo - replace the query and fragment // 5. #foo - replace the fragment only var absoluteUri = baseUri . clone ( ) ; // we satisfy these conditions by looking for the first part of relativeUri // that is not blank and applying defaults to the rest var overridden = relativeUri . hasScheme ( ) ; if ( overridden ) { absoluteUri . setRawScheme ( relativeUri . getRawScheme ( ) ) ; } else { overridden = relativeUri . hasCredentials ( ) ; } if ( overridden ) { absoluteUri . setRawCredentials ( relativeUri . getRawCredentials ( ) ) ; } else { overridden = relativeUri . hasDomain ( ) ; } if ( overridden ) { absoluteUri . setRawDomain ( relativeUri . getRawDomain ( ) ) ; } else { overridden = relativeUri . hasPort ( ) ; } var rawPath = relativeUri . getRawPath ( ) ; var simplifiedPath = collapse_dots ( rawPath ) ; if ( overridden ) { absoluteUri . setPort ( relativeUri . getPort ( ) ) ; simplifiedPath = simplifiedPath && simplifiedPath . replace ( EXTRA_PARENT_PATHS_RE , '' ) ; } else { overridden = ! ! rawPath ; if ( overridden ) { // resolve path properly if ( simplifiedPath . charCodeAt ( 0 ) !== 0x2f /* / */ ) { // path is relative var absRawPath = collapse_dots ( absoluteUri . getRawPath ( ) || '' ) . replace ( EXTRA_PARENT_PATHS_RE , '' ) ; var slash = absRawPath . lastIndexOf ( '/' ) + 1 ; simplifiedPath = collapse_dots ( ( slash ? absRawPath . substring ( 0 , slash ) : '' ) + collapse_dots ( rawPath ) ) . replace ( EXTRA_PARENT_PATHS_RE , '' ) ; } } else { simplifiedPath = simplifiedPath && simplifiedPath . replace ( EXTRA_PARENT_PATHS_RE , '' ) ; if ( simplifiedPath !== rawPath ) { absoluteUri . setRawPath ( simplifiedPath ) ; } } } if ( overridden ) { absoluteUri . setRawPath ( simplifiedPath ) ; } else { overridden = relativeUri . hasQuery ( ) ; } if ( overridden ) { absoluteUri . setRawQuery ( relativeUri . getRawQuery ( ) ) ; } else { overridden = relativeUri . hasFragment ( ) ; } if ( overridden ) { absoluteUri . setRawFragment ( relativeUri . getRawFragment ( ) ) ; } return absoluteUri ; }
resolves a relative url string to a base uri.
@return {URI}
resolves a relative url string to a base uri .