Skip to content

Commit

Permalink
Change URL's port attribute's setter
Browse files Browse the repository at this point in the history
When it's setter is set to the empty string, it should set the underlying URL's port to null. Previously that was a no-op.

This matches Firefox. (Chromium sets the port to zero.)

Test: web-platform-tests/wpt#4101

Demo: http://software.hixie.ch/utilities/js/live-dom-viewer/saved/4054
  • Loading branch information
SimonSapin authored and annevk committed Oct 28, 2016
1 parent 570a418 commit 05ffaa6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
8 changes: 6 additions & 2 deletions url.bs
Original file line number Diff line number Diff line change
Expand Up @@ -2637,8 +2637,12 @@ does return a <a for=urlsyntax>port</a> so one might have assumed the setter to
<a>cannot-be-a-base-URL flag</a> is set, or its <a for=url>scheme</a> is "<code>file</code>",
terminate these steps.

<li><p><a lt="basic URL parser">Basic URL parse</a> the given value with <a>context object</a>'s
<a for=URL>url</a> as <var>url</var> and <a>port state</a> as <var>state override</var>.
<li><p>If the given value is the empty string, then set <a for=URL>url</a>'s <a for=url>port</a> to
null.</p></li>

<li><p>Otherwise, <a lt="basic URL parser">basic URL parse</a> the given value with
<a>context object</a>'s <a for=URL>url</a> as <var>url</var> and <a>port state</a> as
<var>state override</var>.
</ol>

<p>The <dfn attribute for=URL><code>pathname</code></dfn> attribute's getter must run these steps:
Expand Down
5 changes: 4 additions & 1 deletion url.html
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,10 @@ <h3 class="heading settled" data-level="6.2" id="urlutils-members"><span class="
<p>If <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-url-url">url</a>’s <a data-link-type="dfn" href="#concept-url-host">host</a> is null, its <a data-link-type="dfn" href="#url-cannot-be-a-base-url-flag">cannot-be-a-base-URL flag</a> is set, or its <a data-link-type="dfn" href="#concept-url-scheme">scheme</a> is "<code>file</code>",
terminate these steps. </p>
<li>
<p><a data-link-type="dfn" href="#concept-basic-url-parser">Basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-url-url">url</a> as <var>url</var> and <a data-link-type="dfn" href="#port-state">port state</a> as <var>state override</var>. </p>
<p>If the given value is the empty string, then set <a data-link-type="dfn" href="#concept-url-url">url</a>’s <a data-link-type="dfn" href="#concept-url-port">port</a> to
null.</p>
<li>
<p>Otherwise, <a data-link-type="dfn" href="#concept-basic-url-parser">basic URL parse</a> the given value with <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#context-object">context object</a>’s <a data-link-type="dfn" href="#concept-url-url">url</a> as <var>url</var> and <a data-link-type="dfn" href="#port-state">port state</a> as <var>state override</var>. </p>
</ol>
<p>The <dfn class="idl-code" data-dfn-for="URL" data-dfn-type="attribute" data-export="" id="dom-url-pathname"><code>pathname</code><a class="self-link" href="#dom-url-pathname"></a></dfn> attribute’s getter must run these steps: </p>
<ol>
Expand Down

0 comments on commit 05ffaa6

Please sign in to comment.