Sha256: d87d66961e4b0cf15b42cb1dc0eca1a7fd0a9b7eb055945eea66727bdfbe5d87

Contents?: true

Size: 1.04 KB

Versions: 41

Compression:

Stored size: 1.04 KB

Contents

// Copyright 2014 Simon Lydell
// X11 (“MIT”) Licensed. (See LICENSE.)

void (function(root, factory) {
  if (typeof define === "function" && define.amd) {
    define(factory)
  } else if (typeof exports === "object") {
    module.exports = factory()
  } else {
    root.resolveUrl = factory()
  }
}(this, function() {

  function resolveUrl(/* ...urls */) {
    var numUrls = arguments.length

    if (numUrls === 0) {
      throw new Error("resolveUrl requires at least one argument; got none.")
    }

    var base = document.createElement("base")
    base.href = arguments[0]

    if (numUrls === 1) {
      return base.href
    }

    var head = document.getElementsByTagName("head")[0]
    head.insertBefore(base, head.firstChild)

    var a = document.createElement("a")
    var resolved

    for (var index = 1; index < numUrls; index++) {
      a.href = arguments[index]
      resolved = a.href
      base.href = resolved
    }

    head.removeChild(base)

    return resolved
  }

  return resolveUrl

}));

Version data entries

41 entries across 40 versions & 14 rubygems

Version Path
optimacms-0.1.61 spec/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.18.0 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.18.2 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.16.1 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.15.2 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.18.4 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.18.1 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.12.7.pre.puma.pre.3 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.14.0 test/dummy/node_modules/resolve-url/resolve-url.js
disco_app-0.13.6.pre.puma.pre.3 test/dummy/node_modules/resolve-url/resolve-url.js
epuber-stylus-source-0.54.8 vendor/node_modules/resolve-url/resolve-url.js
tang-0.2.1 spec/tang_app/node_modules/resolve-url/resolve-url.js
groonga-client-model-6.0.0 test/apps/rails6.1.3/node_modules/resolve-url/resolve-url.js
groonga-client-model-6.0.0 test/apps/rails6.0.3.5/node_modules/resolve-url/resolve-url.js
ruby2js-4.0.4 lib/tasks/testrails/node_modules/resolve-url/resolve-url.js
ruby2js-4.0.3 lib/tasks/testrails/node_modules/resolve-url/resolve-url.js
tang-0.2.0 spec/tang_app/node_modules/resolve-url/resolve-url.js
tang-0.1.0 spec/tang_app/node_modules/resolve-url/resolve-url.js
tang-0.0.9 spec/tang_app/node_modules/resolve-url/resolve-url.js
enju_library-0.3.8 spec/dummy/node_modules/resolve-url/resolve-url.js