Skip to content

Optionality of history.pushState/replaceState’s unused argument #8278

Open
@bathos

Description

@bathos

The signatures of pushState and replaceState currently require their unused arguments (previously title) even though their url arguments are optional.

interface History {
  /* [...] */
  undefined pushState(any data, DOMString unused, optional USVString? url = null);
  undefined replaceState(any data, DOMString unused, optional USVString? url = null);
};

While the unused arguments are unavoidable for web compat when changing the URL, the explicit second argument being required when updating state alone seems to serve no purpose (and is not particularly obvious). They could be made optional.

(Filed at the suggestion of @annevk. In that context, I was suggesting there might be ways the Web IDL overload resolution algorithm could be made a bit friendlier in general, but the particular example I gave really implied an issue with the specific signatures in question.)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions