This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20918 - "A relative URL is a URL that is relative to a p..."
Summary: "A relative URL is a URL that is relative to a p..."
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: URL (show other bugs)
Version: unspecified
Hardware: PC All
: P2 normal
Target Milestone: Unsorted
Assignee: Anne
QA Contact: sideshowbarker+urlspec
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-09 00:43 UTC by Ian 'Hixie' Hickson
Modified: 2013-02-23 07:54 UTC (History)
2 users (show)

See Also:


Attachments

Description Ian 'Hixie' Hickson 2013-02-09 00:43:20 UTC
http://url.spec.whatwg.org/#urls

The definition of "relative URL" includes absolute URLs. It should be changed to be something like "a URL without a scheme" or some such. (The syntax definition is fine, but doesn't currently describe the same thing as the conceptual definition.)
Comment 1 Anne 2013-02-12 10:42:18 UTC
Well we don't know whether it's relative or absolute until we parse it really. And if you say "without a scheme" you're either referring to pre-parsing or post-parsing. Neither seems desirable.

If it's an absolute URL however, it's certainly not relative to a base URL, so I think the current definition is okay.
Comment 2 Ian 'Hixie' Hickson 2013-02-13 00:23:37 UTC
Right now, the definitions are mutually contradictory:

"A relative URL is a URL that is relative to a parsed URL."
"A relative URL is either a scheme-relative URL, an absolute-path-relative URL, or a path-relative URL that does not start with a scheme and ":", optionally followed by a "?" and a query."

It can't be both these things. Maybe one of these should be "must be" instead of "is", or maybe they should be different terms, or something, but right now the spec doesn't make sense.

As far as the HTML spec goes, I need a term, ideally "relative URL", that means what people generally mean by "relative URL". Doesn't have to be a normative definition; I just need something that means the kind of thing that is a URL but isn't an absolute URL (nor the kind of URL that results in a fatal parse error).


(In reply to comment #1)
> Well we don't know whether it's relative or absolute until we parse it
> really.

Isn't that just a "URL"? Using "relative URL" to mean "a URL that we haven't yet tried to parse" seems bogus.
Comment 3 Anne 2013-02-13 16:10:24 UTC
Ah, so the reason the second instance does not use must is because URL already uses MUST. But that would indeed not allow standalone normative use of relative URL, which is annoying. So that needs to be MUST too.

https://github.com/whatwg/url/commit/5af771097c241c6f2f741d0a6da3856b10032a1e

Before I close again, please let me know if this works.
Comment 4 Ian 'Hixie' Hickson 2013-02-13 19:59:39 UTC
The spec now says:

# A relative URL is a URL that is relative to a parsed URL.
# Such a parsed URL is a base URL.

So in other words, "A relative URL is a URL that is relative to a base URL".

It also says:

# A relative URL must be relative to a base URL with a relative scheme.

So in other words, "A URL that is relative to a base URL must be relative to a base URL with a relative scheme".

I'm not sure what this is trying to say. Are you trying to say "A base URL must have a relative scheme"? If so, that seems to contradict this statement:

# An absolute URL stands on its own and is therefore a potential base URL.

Actually you have a weird situation with "absolute URL" too, where the definition of the term isn't where its <dfn> is. The last quote above is the <dfn> for "absolute URL", but the actual definition seems to be:

# An absolute URL is a scheme, followed by ":", followed by scheme data,
# optionally followed by "?" and a query.

But that (correctly) doesn't require "absolute URL" to have a relative scheme, so the earlier statement "An absolute URL [is a] potential base URL" seems to contradict the other statement.


I think what's going on here is that you're mixing three things: the definitions of core terms like "URL", "relative URL", "absolute URL", and "base URL", the requirements on what the syntax of those things must be, and the definitions of terms you use in those requirements.

IMHO, everywhere in "Writing" where you use the terms "relative URL" and "absolute URL", you should use new terms like "relative URL string" or some such. The requirement "A relative URL must be relative to a base URL with a relative scheme" should move up to the conceptual section, and be phrased as just something like "A base URL must use a relative scheme". In fact, that and the line about absolute URLs being potential base URLs probably just need to be replaced with "base URLs must be absolute URLs with relative schemes".

Finally, "A relative URL is a URL that is relative to a parsed URL" is IMHO just wrong. A relative URL is just a URL that isn't an absolute URL. For example, "/foo" is a relative URL, but it has no base URL. And base URLs don't have to be parsed URLs (e.g. in serialised HTML files, they're not). In fact, I would probably completely change how you define "URL", "relative URL", and "absolute URL", so that you define "URL" as relative URL or absolute URL, and you define absolute URL as things that have all the required components, or some such, such that resolving them has the same result regardless of the base URL.
Comment 5 Anne 2013-02-14 12:22:48 UTC
https://github.com/whatwg/url/commit/1d5e2bf9e6251949f76470e02b82a12ff9d3c73e

Refresh. How are we doing now? :-)
Comment 6 Ian 'Hixie' Hickson 2013-02-23 00:40:06 UTC
I think that works. Thanks.
Comment 7 Anne 2013-02-23 07:54:45 UTC
Alright, lets do new bugs if something comes up.