Intent to Prototype: generate() Method of URLPattern API

140 views
Skip to first unread message

Chromestatus

unread,
May 28, 2025, 10:04:37 PMMay 28
to blin...@chromium.org, sisid...@chromium.org, suzuk...@chromium.org, tn...@chromium.org

Contact emails

tn...@chromium.org

Explainer

https://github.com/explainers-by-googlers/urlpattern-generate

Specification

https://urlpattern.spec.whatwg.org

Summary

Allow developers to construct a URL string from a URLPattern object and a set of provided values for the pattern's parameters. This functionality addresses the need for reverse routing or URL construction, complementing the existing test() and exec() methods that focus on URL matching and parsing.



Blink component

Blink>URLPattern

Motivation

Currently, URLPattern primarily focuses on matching URLs against patterns and extracting information from matched URLs using methods like test() and exec(). There is no standard way to take a URLPattern object (like /user/:id) and a set of values (like id=123) and generate the corresponding URL or component string that matches that pattern (like /user/123). The proposed generate() method aims to fill this gap. There are long-standing needs for this feature in https://github.com/whatwg/urlpattern/issues/73. See the explainer for details: https://github.com/explainers-by-googlers/urlpattern-generate



Initial public proposal

https://docs.google.com/document/d/1ca6geyHD40MfHkalgEv4AcBo9-rHK6CrAOxwcWor9WA

TAG review

None

TAG review status

Pending

Risks



Interoperability and Compatibility

None



Gecko: No signal

WebKit: No signal

Web developers: No signals

Other signals:

WebView application risks

Does this intent deprecate or change behavior of existing APIs, such that it has potentially high risk for Android WebView-based applications?

None



Debuggability

None



Is this feature fully tested by web-platform-tests?

No

Flag name on about://flags

None

Finch feature name

None

Non-finch justification

None

Requires code in //chrome?

False

Tracking bug

https://issues.chromium.org/u/1/issues/414682820

Estimated milestones

No milestones specified



Link to entry on the Chrome Platform Status

https://chromestatus.com/feature/5193626443055104?gate=5141042185371648

This intent message was generated by Chrome Platform Status.
Reply all
Reply to author
Forward
0 new messages