uri=u2.merge(uri) does not work if uri is absolute
160183
def reverse_merge(u2)
			# return self unless uri.scheme
			u2 = u2.clone
			u2 = self.class.new(u2) unless u2.is_a?(self.class)
			if opaque.nil? == u2.opaque.nil?
				u2.soft_merge(self)
			else
				self
			end
		end
1282927
@Pure
	public static URL join(URL urlBase, String... elements) {
		if (urlBase == null) {
			return null;
		}
		final StringBuilder buf = new StringBuilder(decodeHTMLEntities(urlBase.getPath().replaceFirst(
				Pattern.quote(URL_PATH_SEPARATOR) + "+$", "")));  //$NON-NLS-1$//$NON-NLS-2$
		boolean empty;
		for (final String elt : elements) {
			empty = elt == null || elt.length() == 0;
			if (!empty) {
				assert elt != null;
				if (!elt.startsWith(File.separator)
						&& (buf.length() == 0
						|| buf.charAt(buf.length() - 1) != URL_PATH_SEPARATOR_CHAR)) {
					buf.append(URL_PATH_SEPARATOR_CHAR);
				}
				buf.append(elt);
			}
		}
		try {
			if (isJarURL(urlBase)) {
				return new URL(
						urlBase.getProtocol(),
						urlBase.getHost(),
						urlBase.getPort(),
						buf.toString());
			}
			return new URI(
					urlBase.getProtocol(),
					urlBase.getUserInfo(),
					urlBase.getHost(),
					urlBase.getPort(),
					buf.toString(),
					decodeHTMLEntities(urlBase.getQuery()),
					urlBase.getRef()).toURL();
		} catch (Throwable exception) {
			//
		}
		try {
			return new URL(
					urlBase.getProtocol(),
					urlBase.getHost(),
					buf.toString());
		} catch (Throwable exception) {
			return null;
		}
	}
682891
function absoluteUrl (baseUrl, pathUrl) {
  if (pathUrl && pathUrl.slice(0, 4) !== 'http') {
    return [baseUrl, pathUrl].map((path) => {
      if (path[0] === '/') {
        path = path.slice(1)
      }
      if (path[path.length - 1] === '/') {
        path = path.slice(0, path.length - 1)
      }
      return path
    }).join('/')
  }

  return pathUrl
}
981056
private static String resolveURI(final URL baseURI, final Parent parent, String url) {
        url = url.equals(".") || url.equals("./") ? "" : url;
        if (isRelativeURI(url) && parent != null && parent instanceof Element) {
            final Attribute baseAtt = ((Element) parent).getAttribute("base", Namespace.XML_NAMESPACE);
            String xmlBase = baseAtt == null ? "" : baseAtt.getValue();
            if (!isRelativeURI(xmlBase) && !xmlBase.endsWith("/")) {
                xmlBase = xmlBase.substring(0, xmlBase.lastIndexOf("/") + 1);
            }
            return resolveURI(baseURI, parent.getParent(), xmlBase + url);
        } else if (isRelativeURI(url) && parent == null) {
            return baseURI + url;
        } else if (baseURI != null && url.startsWith("/")) {
            String hostURI = baseURI.getProtocol() + "://" + baseURI.getHost();
            if (baseURI.getPort() != baseURI.getDefaultPort()) {
                hostURI = hostURI + ":" + baseURI.getPort();
            }
            return hostURI + url;
        }
        return url;
    }
724717
def build_absolute_uri(self, uri):
        
        request = self.context.get('request', None)

        return (
            request.build_absolute_uri(uri) if request is not None else uri
        )
433566
function getUriRaw() {
  const startPos = pos;
  const type = NodeType.RawType;
  const token = tokens[startPos];
  const line = token.ln;
  const column = token.col;
  let content = [];
  let l;

  while (pos < tokens[startPos].uri_raw_end) {
    if (checkInterpolation(pos) || checkVariable(pos)) break;
    else if (l = checkUriRawCharacters(pos)) pos += l;
    else break;
  }

  content = joinValues(startPos, pos - 1);

  return newNode(type, content, line, column);
}
1007661
function ( uri ) {
		var obj    = {},
		    parsed = {};

		if ( uri === undefined ) {
			uri = !server ? location.href : "";
		}

		if ( !server ) {
			obj = document.createElement( "a" );
			obj.href = uri;
		}
		else {
			obj = url.parse( uri );
		}

		if ( server ) {
			utility.iterate( obj, function ( v, k ) {
				if ( v === null ) {
					obj[k] = undefined;
				}
			});
		}

		parsed = {
			auth     : server ? null : regex.auth.exec( uri ),
			protocol : obj.protocol || "http:",
			hostname : obj.hostname || "localhost",
			port     : obj.port ? number.parse( obj.port, 10 ) : "",
			pathname : obj.pathname,
			search   : obj.search   || "",
			hash     : obj.hash     || "",
			host     : obj.host     || "localhost"
		};

		// 'cause IE is ... IE; required for data.batch()
		if ( client.ie ) {
			if ( parsed.protocol === ":" ) {
				parsed.protocol = location.protocol;
			}

			if ( string.isEmpty( parsed.hostname ) ) {
				parsed.hostname = location.hostname;
			}

			if ( string.isEmpty( parsed.host ) ) {
				parsed.host = location.host;
			}

			if ( parsed.pathname.charAt( 0 ) !== "/" ) {
				parsed.pathname = "/" + parsed.pathname;
			}
		}

		parsed.auth  = obj.auth || ( parsed.auth === null ? "" : parsed.auth[1] );
		parsed.href  = obj.href || ( parsed.protocol + "//" + ( string.isEmpty( parsed.auth ) ? "" : parsed.auth + "@" ) + parsed.host + parsed.pathname + parsed.search + parsed.hash );
		parsed.path  = obj.path || parsed.pathname + parsed.search;
		parsed.query = utility.queryString( null, parsed.search );

		return parsed;
	}
791546
function merge() {
  let i = 1
    , key
    , val
    , obj
    , target
    ;

  // make sure we don't modify source element and it's properties
  // objects are passed by reference
  target = clone( arguments[0] );
  while (obj = arguments[i++]) {
    for (key in obj) {
      if ( !hasOwn(obj, key) ) {
          continue;
      }

      val = obj[key];
      if ( isObject(val) && isObject(target[key]) ){
        // inception, deep merge objects
        target[key] = merge(target[key], val);
      } else {
        let is_url = val && val.type == url;
        let is_path = val && val.type == path;

        // make sure arrays, regexp, date, objects are cloned
        target[key] = clone(val);
        if( is_url ){
          target[key].type = url;
        }

        if( is_path ){
          target[key].type = path;
        }
      }
    }
  }
  return target;
}
492403
function (src, dest) {
            // IE has a mergeAttributes method which does exactly that. Let's use it directly.
            // Note that copying attributes with a loop on attributes and setAttributes has strange results on IE7 (for
            // example, a TR can appear as disabled)
            if (Aria.$window.document.body.mergeAttributes) {
                this.copyAttributes = function (src, dest) {
                    dest.mergeAttributes(src, false);
                };
            } else {
                this.copyAttributes = function (src, dest) {
                    // on other browsers, let's copy the attributes manually:
                    var srcAttr = src.attributes;
                    for (var i = 0, l = srcAttr.length; i < l; i++) {
                        var attr = srcAttr[i];
                        dest.setAttribute(attr.name, attr.value);
                    }
                };
            }

            this.copyAttributes(src, dest);
        }
629653
function callUri(uri) {
  var iframe = document.createElement('iframe');
  iframe.src = uri;
  iframe.style.display = 'none';
  document.documentElement.appendChild(iframe);
  setTimeout(function () {
    return document.documentElement.removeChild(iframe);
  }, 0);
}
72493
def expand_relative_uri(self, context, uri):
        
        full_uri = urljoin(context, uri)
        if (full_uri != uri):
            print("  WARNING - expanded relative URI to %s" % (full_uri))
            uri = full_uri
        return(uri)
361791
def resolve_url(href_str, absolute_url_str)
      if absolute_url_str.class <= URI::Generic
        absolute_url = absolute_url_str.dup
      else
        begin
          absolute_url = URI(absolute_url_str).dup
        rescue URI::InvalidURIError
          raise ArgumentError, "#{absolute_url_str} must be represent a valid relative or absolute URI" 
        end
      end
      raise ArgumentError, "#{absolute_url} must be absolute" unless absolute_url.absolute?
      if href_str.class <= URI::Generic
        href = href_str.dup
      else
        begin
          href = URI(href_str).dup
        rescue URI::InvalidURIError
          raise ArgumentError, "#{href_str} must be represent a valid relative or absolute URI"
        end
      end

      # return :href if :href is already absolute
      return href.to_s if href.absolute?

      #TODO: edge cases, see [issue #8](https://github.com/propublica/upton/issues/8)
      URI.join(absolute_url.to_s, href.to_s).to_s
    end
1308573
function merge(src1, src2) {
    var merged = {};
    extend(merged, src1);
    extend(merged, src2);
    return merged;
}
1276024
def __extend_uri(prefixes, short):
    
    for prefix in prefixes:
        if short.startswith(prefix):
            return short.replace(prefix + ':', prefixes[prefix])
    return short
38827
public static boolean isAbsoluteUrl(String location) {
        if (location != null && location.length() > 0 && location.contains(":")) {
            try {
                URI uri = new URI(location);
                return uri.getScheme() != null;
            } catch (URISyntaxException e) {
                // ignore invalid locations and consider not absolute
            }
        }
        return false;
    }
407124
def to_absolute(link)
      return nil if link.nil?

      # remove anchor
      link = URI.encode(URI.decode(link.to_s.gsub(/#[a-zA-Z0-9_-]*$/,'')))

      relative = URI(link)
      absolute = base ? base.merge(relative) : @url.merge(relative)

      absolute.path = '/' if absolute.path.empty?

      return absolute
    end
560538
def rel_to_abs(self, base_url):
        
        self.cleaned_css = self.rel_to_abs_re.sub(
            lambda match: "url('%s')" % urljoin(
                base_url, match.group('path').strip('\'"')),
            self.cleaned_css)