-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
delimiter characters not included in component parts #227
Comments
These all have different names in the URL spec to differentiate the undelimited value from the delimited:
|
I'm fairly confident the bottom line here is that it's too late to make a breaking change that would affect a very large fraction of usage of this API (essentially every use that specifies or checks Is there some other resolution (such as clarifying that this discrepancy exists in the text of the standard, or adding some sort of developer warning to tooling), that you're seeking? There is some shaving of this rough edge (e.g., I'm not sure whether the scheme/protocol, query/search, etc distinction you mention in the WHATWG URL standard is intentional or not (@annevk might know offhand?). I suspect it's more of a historical artifact than anything else, but I'm not sure. |
I would think now is the time to make breaking changes if any. It's not yet implemented in Firefox and Safari and the WPT conformance coverage is still scanty.
How prevalent is this actually? Here's my attempt at figuring it out, which suggests "not very": Most of the usage seems to prefer the
I think that clarifying language is not extremely helpful here. This is the type of subtle inconsistency that you probably don't notice until it actually bites you by writing something like
URL canonicalizes this too: For query and hash, this normalization creates even more problems, since
It makes sense in these cases that canonicalization should be idempotent (give the same result if you do it twice). But if the query can legally contain |
That the names are distinct between the model and the API is indeed largely due to history. I do think it's a compelling point that if an accessor looks equivalent but behaves differently it might lead to confusion and more complicated code. |
I would rather change now than later, for sure. But from a Chromium perspective, I think we'll have a much harder time shipping changes if they break web content, regardless of whether other engines ship URLPattern. And because it's feature-detectable and polyfillable, its absence in other engines doesn't guarantee that developers don't rely on present behavior. And that reliance wouldn't only affect Chromium-based browser users, since if another engine shipped the feature it would cause code that was feature-detecting it to start taking a path that may assume today's behavior.
Chrome's use counters do agree that
But checking the result of
Unfortunately I don't think even including the delimiter characters makes this a valid thing to do in generality.
Given it is canonicalized, is the concern exclusively what is read when you access the component properties on the On the one hand, consistency for
Interesting; I didn't know that multiple delimiters ended up canonicalized away like that. I agree it's surprising (if a bit contrived in practice); do you know if it happens for a reason related to the delimiters being included in the component parts? URL also normalizes those delimiters away and only adds them back in the setter, so I wonder if it's a separate issue. |
As long as they lead to the same canonicalization, the trailing For instances
You're right. Perhaps I'm for deprecating these getters entirely... Having the Also, there's no way to use the individual components of a
Agreed. Though for a
I don't know. I thought URL normalize the URL (e.g. that According to RFC 3986, these URLs should be considered different:
|
What is the issue with the URL Pattern Standard?
In the
URL
standard, delimiters are included in their respective parts (hash, protocol, and search):e.g.
new URL("http://example.com:80/bar?baz=bang#id")
preserve the delimiters:On the other hand,
URLPattern
objects omit these delimiters:The text was updated successfully, but these errors were encountered: