Skip to content
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

Editorial: Add proper serialization of URL properties #224

Merged
merged 4 commits into from
Apr 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ spec: ECMASCRIPT; urlPrefix: https://tc39.es/ecma262/
spec: URL; urlPrefix: https://url.spec.whatwg.org/
type: dfn
text: serialize an integer; url: #serialize-an-integer
text: host serializer; url: #concept-host-serializer
</pre>

<h2 id=urlpatterns>URL patterns</h2>
Expand Down Expand Up @@ -506,8 +507,8 @@ A <dfn>component</dfn> is a [=struct=] with the following [=struct/items=]:
1. Set |protocol| to |url|'s [=url/scheme=].
1. Set |username| to |url|'s [=url/username=].
1. Set |password| to |url|'s [=url/password=].
1. Set |hostname| to |url|'s [=url/host=] or the empty string if the value is null.
1. Set |port| to |url|'s [=url/port=] or the empty string if the value is null.
1. Set |hostname| to |url|'s [=url/host=], [=host serializer|serialized=], or the empty string if the value is null.
1. Set |port| to |url|'s [=url/port=], [=serialize an integer|serialized=], or the empty string if the value is null.
1. Set |pathname| to the result of [=URL path serializing=] |url|.
1. Set |search| to |url|'s [=url/query=] or the empty string if the value is null.
1. Set |hash| to |url|'s [=url/fragment=] or the empty string if the value is null.
Expand Down Expand Up @@ -1726,7 +1727,7 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier
1. Let |dummyURL| be a new [=URL record=].
1. Let |parseResult| be the result of running the [=basic URL parser=] given |value| with |dummyURL| as <i>[=basic URL parser/url=]</i> and [=hostname state=] as <i>[=basic URL parser/state override=]</i>.
1. If |parseResult| is failure, then throw a {{TypeError}}.
1. Return |dummyURL|'s [=url/host=].
1. Return |dummyURL|'s [=url/host=], [=host serializer|serialized=], or empty string if it is null.
</div>

<div algorithm>
Expand All @@ -1749,7 +1750,7 @@ To <dfn>convert a modifier to a string</dfn> given a [=part/modifier=] |modifier
<div algorithm>
To <dfn>canonicalize a port</dfn> given a string |portValue| and optionally a string |protocolValue|:

1. If |value| is the empty string, return |value|.
1. If |portValue| is the empty string, return |portValue|.
1. Let |dummyURL| be a new [=URL record=].
1. If |protocolValue| was given, then set |dummyURL|'s [=url/scheme=] to |protocolValue|.
<p class="note">Note, we set the [=URL record=]'s [=url/scheme=] in order for the [=basic URL parser=] to recognize and normalize default port values.</p>
Expand Down
Loading