Skip to content

WHATWG URL API: base ignored if relative path starts with a double slash #30776

Description

@scottinet
  • Version: 12.13.1
  • Platform: all
  • Subsystem: url

Instantiating a new WHATWG URL with a base option, and a relative URL starting with a double slash ends up with the base option being ignored.

How to reproduce

const foo = new URL('//foo/bar', 'http://fake');

Expected result

URL {
  href: 'http://fake//foo/bar',
  origin: 'http://fake',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'fake',
  hostname: 'fake',
  port: '',
  pathname: '//foo/bar',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

Actual result

URL {
  href: 'http://foo/bar',
  origin: 'http://foo',
  protocol: 'http:',
  username: '',
  password: '',
  host: 'foo',
  hostname: 'foo',
  port: '',
  pathname: '/bar',
  search: '',
  searchParams: URLSearchParams {},
  hash: ''
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    invalidIssues and PRs that are invalid.whatwg-urlIssues and PRs related to the WHATWG URL implementation.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions