Skip to content

Commit 451696e

Browse files
committed
Editorial: give URL syntax components their own terms
Rather avoiding collision with URL records in a rather dubious way, actually give each potential string segment of a URL string its own unique term. Fixes #157.
1 parent 3e880f2 commit 451696e

File tree

2 files changed

+144
-169
lines changed

2 files changed

+144
-169
lines changed

url.bs

Lines changed: 71 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -921,7 +921,7 @@ non-null.
921921
<p>A <a for=/>URL</a> can be designated as <dfn id=concept-base-url>base URL</dfn>.
922922

923923
<p class="note no-backref">A <a>base URL</a> is useful for the <a>URL parser</a> when the
924-
input might be a <a for=urlsyntax>relative URL</a>.
924+
input might be a <a>relative-URL string</a>.
925925

926926
<hr>
927927

@@ -936,102 +936,93 @@ if any.
936936

937937
<!-- http://tantek.com/2011/238/b1/many-ways-slice-url-name-pieces -->
938938

939-
<p>A <dfn export for=urlsyntax id=syntax-url lt="URL|URL string">URL</dfn> must be either
940-
a <a>relative URL with fragment</a> or an <a>absolute URL with fragment</a>. To
941-
disambiguate from a <a for=/>URL record</a> it can also be referred to as a <a>URL string</a>.
939+
<p>A <dfn export id=syntax-url>URL string</dfn> must be either a
940+
<a>relative-URL-with-fragment string</a> or an <a>absolute-URL-with-fragment string</a>.
942941

943942
<p>An
944-
<dfn export for=urlsyntax id=syntax-url-absolute-with-fragment>absolute URL with fragment</dfn>
945-
must be an <a for=urlsyntax>absolute URL</a>, optionally followed by "<code>#</code>" and a
946-
<a for=urlsyntax>fragment</a>.
943+
<dfn export id=syntax-url-absolute-with-fragment>absolute-URL-with-fragment string</dfn> must be an
944+
<a>absolute-URL string</a>, optionally followed by "<code>#</code>" and a
945+
<a>URL-fragment string</a>.
947946

948-
<p>An <dfn export for=urlsyntax id=syntax-url-absolute>absolute URL</dfn> must be one of
949-
the following
947+
<p>An <dfn export id=syntax-url-absolute>absolute-URL string</dfn> must be one of the following
950948

951949
<ul class=brief>
952-
<li><p>a <a for=urlsyntax>scheme</a> that is an <a spec=dom>ASCII case-insensitive</a>
953-
match for a <a>special scheme</a> and not an <a spec=dom>ASCII case-insensitive</a> match
954-
for "<code>file</code>", followed by "<code>:</code>" and a <a>scheme-relative URL</a>
955-
<li><p>a <a for=urlsyntax>scheme</a> that is <em>not</em> an
956-
<a spec=dom>ASCII case-insensitive</a> match for a <a>special scheme</a>, followed by
957-
"<code>:</code>" and a <a for=urlsyntax>relative URL</a>
958-
<li><p>a <a for=urlsyntax>scheme</a> that is an <a spec=dom>ASCII case-insensitive</a>
950+
<li><p>a <a>URL-scheme string</a> that is an <a spec=dom>ASCII case-insensitive</a> match for a
951+
<a>special scheme</a> and not an <a spec=dom>ASCII case-insensitive</a> match for
952+
"<code>file</code>", followed by "<code>:</code>" and a <a>scheme-relative-URL string</a>
953+
<li><p>a <a>URL-scheme string</a> that is <em>not</em> an <a spec=dom>ASCII case-insensitive</a>
954+
match for a <a>special scheme</a>, followed by "<code>:</code>" and a <a>relative-URL string</a>
955+
<li><p>a <a>URL-scheme string</a> that is an <a spec=dom>ASCII case-insensitive</a>
959956
match for "<code>file</code>", followed by "<code>:</code>" and a
960-
<a>scheme-relative file URL</a>
957+
<a>scheme-relative-file-URL string</a>
961958
</ul>
962959

963-
<p>any optionally followed by "<code>?</code>" and a <a for=urlsyntax>query</a>.
960+
<p>any optionally followed by "<code>?</code>" and a <a>URL-query string</a>.
964961

965-
<p>A <dfn export for=urlsyntax id=syntax-url-scheme>scheme</dfn> must be one
966-
<a>ASCII alpha</a>, followed by zero or more of <a>ASCII alphanumeric</a>,
967-
"<code>+</code>", "<code>-</code>", and "<code>.</code>". <a for=urlsyntax>Schemes</a>
968-
should be registered in the <cite>IANA URI [sic] Schemes</cite> registry.
962+
<p>A <dfn export id=syntax-url-scheme>URL-scheme string</dfn> must be one <a>ASCII alpha</a>,
963+
followed by zero or more of <a>ASCII alphanumeric</a>, "<code>+</code>", "<code>-</code>", and
964+
"<code>.</code>". <a lt="URL-scheme string">Schemes</a> should be registered in the
965+
<cite>IANA URI [sic] Schemes</cite> registry.
969966
[[!IANA-URI-SCHEMES]]
970967
[[RFC7595]]
971968

972-
<p>A
973-
<dfn export for=urlsyntax id=syntax-url-relative-with-fragment>relative URL with fragment</dfn>
974-
must be a <a for=urlsyntax>relative URL</a>, optionally followed by "<code>#</code>" and a
975-
<a for=urlsyntax>fragment</a>.
969+
<p>A <dfn export id=syntax-url-relative-with-fragment>relative-URL-with-fragment string</dfn>
970+
must be a <a>relative-URL string</a>, optionally followed by "<code>#</code>" and a
971+
<a>URL-fragment string</a>.
976972

977-
<p>A <dfn export for=urlsyntax id=syntax-url-relative>relative URL</dfn> must be one of
978-
the following, switching on <a>base URL</a>'s <a for=url>scheme</a>:
973+
<p>A <dfn export id=syntax-url-relative>relative-URL string</dfn> must be one of the following,
974+
switching on <a>base URL</a>'s <a for=url>scheme</a>:
979975

980976
<dl class=switch>
981977
<dt>Not "<code>file</code>"
982-
<dd><p>a <a>scheme-relative URL</a>
983-
<dd><p>a <a>path-absolute URL</a>
984-
<dd><p>a <a>path-relative scheme-less URL</a>
978+
<dd><p>a <a>scheme-relative-URL string</a>
979+
<dd><p>a <a>path-absolute-URL string</a>
980+
<dd><p>a <a>path-relative-scheme-less-URL string</a>
985981
<dt>"<code>file</code>"
986-
<dd><p>a <a>scheme-relative file URL</a>
987-
<dd><p>a <a>path-absolute URL</a> if <a>base URL</a>'s <a for=url>host</a> is null
988-
<dd><p>a <a>path-absolute non-Windows-file URL</a> if <a>base URL</a>'s
989-
<a for=url>host</a> is non-null
990-
<dd><p>a <a>path-relative scheme-less URL</a>
982+
<dd><p>a <a>scheme-relative-file-URL string</a>
983+
<dd><p>a <a>path-absolute-URL string</a> if <a>base URL</a>'s <a for=url>host</a> is null
984+
<dd><p>a <a>path-absolute-non-Windows-file-URL string</a> if <a>base URL</a>'s <a for=url>host</a>
985+
is non-null
986+
<dd><p>a <a>path-relative-scheme-less-URL string</a>
991987
</dl>
992988

993-
<p>any optionally followed by "<code>?</code>" and a <a for=urlsyntax>query</a>.
989+
<p>any optionally followed by "<code>?</code>" and a <a>URL-query string</a>.
994990

995991
<p class="note no-backref">A non-null <a>base URL</a> is necessary when
996-
<a lt="URL parser">parsing</a> a <a for=urlsyntax>relative URL</a>.
992+
<a lt="URL parser">parsing</a> a <a>relative-URL string</a>.
997993

998-
<p>A <dfn export for=urlsyntax id=syntax-url-scheme-relative>scheme-relative URL</dfn>
999-
must be "<code>//</code>", followed by a <a for=hostsyntax>host</a>, optionally followed
1000-
by "<code>:</code>" and a <a for=urlsyntax>port</a>, optionally followed by a
1001-
<a>path-absolute URL</a>.
994+
<p>A <dfn export id=syntax-url-scheme-relative>scheme-relative-URL string</dfn> must be
995+
"<code>//</code>", followed by a <a for=hostsyntax>host</a>, optionally followed by "<code>:</code>"
996+
and a <a>URL-port string</a>, optionally followed by a <a>path-absolute-URL string</a>.
1002997

1003-
<p>A <dfn export for=urlsyntax id=syntax-url-port>port</dfn> must be zero or more
1004-
<a>ASCII digits</a>.
998+
<p>A <dfn export id=syntax-url-port>URL-port string</dfn> must be zero or more <a>ASCII digits</a>.
1005999

1006-
<p>A
1007-
<dfn export for=urlsyntax id=syntax-url-file-scheme-relative>scheme-relative file URL</dfn>
1008-
must be "<code>//</code>", followed by one of the following
1000+
<p>A <dfn export id=syntax-url-file-scheme-relative>scheme-relative-file-URL string</dfn> must be
1001+
"<code>//</code>", followed by one of the following
10091002

10101003
<ul class=brief>
10111004
<li><p>a <a for=hostsyntax>host</a>, optionally followed by a
1012-
<a>path-absolute non-Windows-file URL</a>
1013-
<li><p>a <a>path-absolute URL</a>.
1005+
<a>path-absolute-non-Windows-file-URL string</a>
1006+
<li><p>a <a>path-absolute-URL string</a>.
10141007
</ul>
10151008

1016-
<p>A <dfn export for=urlsyntax id=syntax-url-path-absolute>path-absolute URL</dfn> must be
1017-
"<code>/</code>" followed by a <a>path-relative URL</a>.
1009+
<p>A <dfn export id=syntax-url-path-absolute>path-absolute-URL string</dfn> must be "<code>/</code>"
1010+
followed by a <a>path-relative-URL string</a>.
10181011

1019-
<p>A
1020-
<dfn export for=urlsyntax id=syntax-url-file-path-absolute>path-absolute non-Windows-file URL</dfn>
1021-
must be a <a>path-absolute URL</a> that does not start with "<code>/</code>", followed by
1012+
<p>A <dfn export id=syntax-url-file-path-absolute>path-absolute-non-Windows-file-URL string</dfn>
1013+
must be a <a>path-absolute-URL string</a> that does not start with "<code>/</code>", followed by
10221014
a <a>Windows drive letter</a>, followed by "<code>/</code>".
10231015

1024-
<p>A <dfn export for=urlsyntax id=syntax-url-path-relative>path-relative URL</dfn> must be
1025-
zero or more <a for=urlsyntax>path segments</a>, separated from each other by "<code>/</code>", and
1026-
not start with "<code>/</code>".
1016+
<p>A <dfn export id=syntax-url-path-relative>path-relative-URL string</dfn> must be zero or more
1017+
<a lt="URL-path-segment string">path segments</a>, separated from each other by "<code>/</code>",
1018+
and not start with "<code>/</code>".
10271019

1028-
<p>A
1029-
<dfn export for=urlsyntax id=syntax-url-path-relative-scheme-less>path-relative scheme-less URL</dfn>
1030-
must be a <a>path-relative URL</a> that does not start with a <a for=urlsyntax>scheme</a>
1031-
and "<code>:</code>".
1020+
<p>A <dfn export id=syntax-url-path-relative-scheme-less>path-relative-scheme-less-URL string</dfn>
1021+
must be a <a>path-relative-URL string</a> that does not start with a <a>URL-scheme string</a> and
1022+
"<code>:</code>".
10321023

1033-
<p>A <dfn export for=urlsyntax id=syntax-url-path-segment>path segment</dfn> must be one
1034-
of the following
1024+
<p>A <dfn export id=syntax-url-path-segment>URL-path-segment string</dfn> must be one of the
1025+
following
10351026

10361027
<ul class=brief>
10371028
<li><p>zero or more <a>URL units</a>, excluding "<code>/</code>" and "<code>?</code>",
@@ -1041,20 +1032,16 @@ of the following
10411032
<li><p>a <a>double-dot path segment</a>.
10421033
</ul>
10431034

1044-
<p>A
1045-
<dfn export for=urlsyntax id=syntax-url-path-segment-dot>single-dot path segment</dfn>
1046-
must be "<code>.</code>" or an <a spec=dom>ASCII case-insensitive</a> match for
1047-
"<code>%2e</code>".
1035+
<p>A <dfn export id=syntax-url-path-segment-dot>single-dot path segment</dfn> must be
1036+
"<code>.</code>" or an <a spec=dom>ASCII case-insensitive</a> match for "<code>%2e</code>".
10481037

1049-
<p>A
1050-
<dfn export for=urlsyntax id=syntax-url-path-segment-dotdot>double-dot path segment</dfn>
1051-
must be "<code>..</code>" or an <a spec=dom>ASCII case-insensitive</a> match for
1052-
"<code>.%2e</code>", "<code>%2e.</code>", or "<code>%2e%2e</code>".
1038+
<p>A <dfn export id=syntax-url-path-segment-dotdot>double-dot path segment</dfn> must be
1039+
"<code>..</code>" or an <a spec=dom>ASCII case-insensitive</a> match for "<code>.%2e</code>",
1040+
"<code>%2e.</code>", or "<code>%2e%2e</code>".
10531041

1054-
<p>A <dfn export for=urlsyntax id=syntax-url-query>query</dfn> must be zero or more
1055-
<a>URL units</a>.
1042+
<p>A <dfn export id=syntax-url-query>URL-query string</dfn> must be zero or more <a>URL units</a>.
10561043

1057-
<p>A <dfn export for=urlsyntax id=syntax-url-fragment>fragment</dfn> must be zero or more
1044+
<p>A <dfn export id=syntax-url-fragment>URL-fragment string</dfn> must be zero or more
10581045
<a>URL units</a>.
10591046

10601047
<p>The <dfn>URL code points</dfn> are <a>ASCII alphanumeric</a>,
@@ -1101,10 +1088,10 @@ U+100000 to U+10FFFD.
11011088

11021089
<p class=note>Code points higher than U+007F will be converted to
11031090
<a lt="percent-encoded byte">percent-encoded bytes</a> by the <a>URL parser</a>, except for code
1104-
points appearing in <a for=url lt=fragment>fragments</a>.
1091+
points appearing in <a lt="URL-fragment string">fragments</a>.
11051092

11061093
<p class=note>In HTML, when the document encoding is a legacy encoding, code points in the
1107-
<a for=urlsyntax>query</a> that are higher than U+007F will be converted to
1094+
<a>URL-query string</a> that are higher than U+007F will be converted to
11081095
<a lt="percent-encoded byte">percent-encoded bytes</a> <em>using the document's encoding</em>. This
11091096
can cause problems if a URL that works in one document is copied to another document that uses a
11101097
different document encoding. Using the <a>UTF-8</a> encoding everywhere solves this problem.
@@ -1134,7 +1121,7 @@ different document encoding. Using the <a>UTF-8</a> encoding everywhere solves t
11341121

11351122
<p class="note no-backref">There is no conforming way to express a
11361123
<a for=url>username</a> or <a for=url>password</a> of a <a for=/>URL record</a> within a
1137-
<a for=urlsyntax>URL string</a>.
1124+
<a>URL string</a>.
11381125

11391126

11401127
<h3 id=url-parsing>URL parsing</h3>
@@ -2172,7 +2159,7 @@ form, with these modifications:
21722159
<li><p>A <a for=/>URL</a>'s <a for=url>host</a> should be rendered using
21732160
<a>domain to Unicode</a>.
21742161

2175-
<li><p>Other parts of the <a for=urlsyntax>URL</a> should have their sequences of
2162+
<li><p>Other parts of the <a for=/>URL</a> should have their sequences of
21762163
<a>percent-encoded bytes</a> replaced with code points resulting from
21772164
<a>percent decoding</a> those sequences converted to bytes, unless that renders those
21782165
sequences invisible.
@@ -2482,7 +2469,7 @@ var input = "https://example.org/💩",
24822469
url = new URL(input)
24832470
url.pathname // "/%F0%9F%92%A9"</pre>
24842471

2485-
<p>This throws an exception if the input is not an <a for=urlsyntax>absolute URL</a>:
2472+
<p>This throws an exception if the input is not an <a>absolute-URL string</a>:
24862473

24872474
<pre>
24882475
try {
@@ -2491,7 +2478,7 @@ try {
24912478
// that happened
24922479
}</pre>
24932480

2494-
<p>A <a>base URL</a> is necessary if the input is a <a for=urlsyntax>relative URL</a>:
2481+
<p>A <a>base URL</a> is necessary if the input is a <a>relative-URL string</a>:
24952482

24962483
<pre>
24972484
var input = "/🍣🍺",
@@ -2604,9 +2591,10 @@ compatibility with HTML's <code>MessageEvent</code> feature. [[!HTML]]
26042591
</ol>
26052592

26062593
<p class="note no-backref">If the given value for the <code><a attribute for=URL>host</a></code>
2607-
attribute's setter lacks a <a for=urlsyntax>port</a>, <a>context object</a>'s <a for=URL>url</a>'s
2608-
<a for=url>port</a> will not change. This can be unexpected as <code>host</code> attribute's getter
2609-
does return a <a for=urlsyntax>port</a> so one might have assumed the setter to always "reset" both.
2594+
attribute's setter lacks a <a lt="URL-port string">port</a>, <a>context object</a>'s
2595+
<a for=URL>url</a>'s <a for=url>port</a> will not change. This can be unexpected as
2596+
<code>host</code> attribute's getter does return a <a>URL-port string</a> so one might have assumed
2597+
the setter to always "reset" both.
26102598

26112599
<p>The <dfn attribute for=URL><code>hostname</code></dfn> attribute's getter must run these steps:
26122600

0 commit comments

Comments
 (0)