How to use the whatwg-url.basicURLParse function in whatwg-url

To help you get started, we’ve selected a few whatwg-url examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jsdom / jsdom / lib / jsdom / living / nodes / HTMLHyperlinkElementUtils-impl.js View on Github external
set protocol(v) {
    reinitializeURL(this);

    if (this.url === null) {
      return;
    }

    whatwgURL.basicURLParse(v + ":", { url: this.url, stateOverride: "scheme start" });
    updateHref(this);
  }
github jsdom / jsdom / lib / jsdom / living / window / Location-impl.js View on Github external
set host(v) {
    const copyURL = Object.assign({}, this._url);

    if (copyURL.cannotBeABaseURL) {
      return;
    }

    whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "host" });

    this._locationObjectSetterNavigate(copyURL);
  }
github jsdom / jsdom / lib / jsdom / living / window / Location-impl.js View on Github external
set search(v) {
    const copyURL = Object.assign({}, this._url);

    if (v === "") {
      copyURL.query = null;
    } else {
      const input = v[0] === "?" ? v.substring(1) : v;
      copyURL.query = "";
      whatwgURL.basicURLParse(input, {
        url: copyURL,
        stateOverride: "query",
        encodingOverride: this._relevantDocument.charset
      });
    }

    this._locationObjectSetterNavigate(copyURL);
  }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / nodes / HTMLHyperlinkElementUtils-impl.js View on Github external
set port(v) {
    reinitializeURL(this);
    const { url } = this;

    if (url === null || url.host === null || url.host === "" || url.cannotBeABaseURL || url.scheme === "file") {
      return;
    }

    if (v === "") {
      url.port = null;
    } else {
      whatwgURL.basicURLParse(v, { url, stateOverride: "port" });
    }
    updateHref(this);
  }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / window / Location-impl.js View on Github external
set protocol(v) {
    const copyURL = Object.assign({}, this._url);

    const possibleFailure = whatwgURL.basicURLParse(v + ":", { url: copyURL, stateOverride: "scheme start" });
    if (possibleFailure === null) {
      throw new TypeError(`Could not parse the URL after setting the procol to "${v}"`);
    }

    if (copyURL.scheme !== "http" && copyURL.scheme !== "https") {
      return;
    }

    this._locationObjectSetterNavigate(copyURL);
  }
github jsdom / jsdom / lib / jsdom / living / nodes / HTMLHyperlinkElementUtils-impl.js View on Github external
set pathname(v) {
    reinitializeURL(this);
    const { url } = this;

    if (url === null || url.cannotBeABaseURL) {
      return;
    }

    url.path = [];
    whatwgURL.basicURLParse(v, { url, stateOverride: "path start" });
    updateHref(this);
  }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / window / Location-impl.js View on Github external
set port(v) {
    const copyURL = Object.assign({}, this._url);

    if (copyURL.host === null || copyURL.cannotBeABaseURL || copyURL.scheme === "file") {
      return;
    }

    whatwgURL.basicURLParse(v, { url: copyURL, stateOverride: "port" });

    this._locationObjectSetterNavigate(copyURL);
  }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / nodes / HTMLHyperlinkElementUtils-impl.js View on Github external
set pathname(v) {
    reinitializeURL(this);
    const { url } = this;

    if (url === null || url.cannotBeABaseURL) {
      return;
    }

    url.path = [];
    whatwgURL.basicURLParse(v, { url, stateOverride: "path start" });
    updateHref(this);
  }
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / nodes / HTMLHyperlinkElementUtils-impl.js View on Github external
set hash(v) {
    reinitializeURL(this);
    const { url } = this;

    if (url === null) {
      return;
    }

    if (v === "") {
      url.fragment = null;
    } else {
      const input = v[0] === "#" ? v.substring(1) : v;
      url.fragment = "";
      whatwgURL.basicURLParse(input, { url, stateOverride: "fragment" });
    }
    updateHref(this);
  }
};
github sx1989827 / DOClever / node_modules / jsdom / lib / jsdom / living / window / Location-impl.js View on Github external
set hash(v) {
    const copyURL = Object.assign({}, this._url);

    if (copyURL.scheme === "javascript") {
      return;
    }

    if (v === "") {
      copyURL.fragment = null;
    } else {
      const input = v[0] === "#" ? v.substring(1) : v;
      copyURL.fragment = "";
      whatwgURL.basicURLParse(input, { url: copyURL, stateOverride: "fragment" });
    }

    this._locationObjectSetterNavigate(copyURL);
  }