Skip to content

Why does this test succeed with pathname "/foo/bar"? #240

Description

@anonrig

What is the issue with the URL Pattern Standard?

Referencing a WPT test:

  {
    "pattern": [{ "pathname": "./foo/bar", "baseURL": "https://example.com" }],
    "inputs": [{ "pathname": "foo/bar", "baseURL": "https://example.com" }],
    "exactly_empty_components": [ "port" ],
    "expected_obj": {
      "pathname": "/foo/bar"
    },
    "expected_match": {
      "protocol": { "input": "https", "groups": {}},
      "hostname": { "input": "example.com", "groups": {}},
      "pathname": { "input": "/foo/bar", "groups": {}}
    }
  },

canonicalize_pathname method adds /- and removes /- from the method for several reasons. Ref: https://urlpattern.spec.whatwg.org/#canonicalize-a-pathname

Why does the expected_obj has a pathname of /foo/bar but not ./foo/bar?

cc @annevk @jeremyroman would you mind helping me understand the behavior here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions