Skip to content
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
152 changes: 69 additions & 83 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3328,7 +3328,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<dfn data-x="concept-node-clone-parent" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-parent"><var>parent</var></dfn>, and
<dfn data-x="concept-node-clone-fallbackRegistry" data-x-href="https://dom.spec.whatwg.org/#clone-a-node-fallbackregistry"><var>fallbackRegistry</var></dfn>, and the concept of
<dfn data-x="concept-node-clone-ext" data-x-href="https://dom.spec.whatwg.org/#concept-node-clone-ext">cloning steps</dfn></li>
<li>The concept of <dfn>base URL change steps</dfn> and the definition of what happens when an element is <dfn>affected by a base URL change</dfn></li>
<li>The concept of an element's <dfn data-x="concept-id" data-x-href="https://dom.spec.whatwg.org/#concept-id">unique identifier (ID)</dfn></li>
<li>The concept of an element's <dfn data-x="concept-class" data-x-href="https://dom.spec.whatwg.org/#concept-class">classes</dfn></li>
<li>The term <dfn data-x="concept-supported-tokens" data-x-href="https://dom.spec.whatwg.org/#concept-supported-tokens">supported tokens</dfn></li>
Expand Down Expand Up @@ -7216,6 +7215,8 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
data-x="strip leading and trailing ASCII whitespace">stripping leading and trailing ASCII
whitespace</span> from it, it is a <span>valid non-empty URL</span>.</p>

<hr>

<p>This specification defines the URL <dfn><code>about:legacy-compat</code></dfn> as a reserved,
though unresolvable, <code data-x="about protocol">about:</code> URL, for use in <span
data-x="syntax-doctype">DOCTYPE</span>s in <span>HTML documents</span> when needed for
Expand All @@ -7231,46 +7232,6 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
document"><code>iframe</code> <code data-x="attr-iframe-srcdoc">srcdoc</code> documents</span>.
<ref>ABOUT</ref></p>

<p>The <dfn>fallback base URL</dfn> of a <code>Document</code> object <var>document</var> is the
<span>URL record</span> obtained by running these steps:</p>

<ol>
<li>
<p>If <var>document</var> is <span data-x="an iframe srcdoc document">an <code>iframe</code>
<code data-x="attr-iframe-srcdoc">srcdoc</code> document</span>, then:</p>

<ol>
<li><p><span>Assert</span>: <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null.</p></li>

<li><p>Return <var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span>.</p></li>
</ol>
</li>

<li><p>If <var>document</var>'s <span data-x="concept-document-url">URL</span> <span>matches
<code>about:blank</code></span> and <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null, then return
<var>document</var>'s <span data-x="concept-document-about-base-url">about base URL</span>.</p></li>

<!-- https://www.hixie.ch/tests/adhoc/dom/level0/history/pushState/001/ -->

<li><p>Return <var>document</var>'s <span data-x="concept-document-url">URL</span>.</p></li>
</ol>

<p>The <dfn export>document base URL</dfn> of a <code>Document</code> object is the
<span>URL record</span> obtained by running these steps:</p>

<ol>
<li><p>If there is no <code>base</code> element that has an <code
data-x="attr-base-href">href</code> attribute in the <code>Document</code>, then return the
<code>Document</code>'s <span>fallback base URL</span>.</p></li>

<li><p>Otherwise, return the <span>frozen base URL</span> of the first <code>base</code> element
in the <code>Document</code> that has an <code data-x="attr-base-href">href</code> attribute, in
<span>tree order</span>.</p></li>
</ol>

<hr>

<p>A <span>URL</span> <dfn>matches <code>about:blank</code></dfn> if its <span
Expand Down Expand Up @@ -7378,58 +7339,82 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<div w-nodev>

<h4>Dynamic changes to base URLs</h4>
<h4>Document base URLs</h4>

<p>When a document's <span>document base URL</span> changes, all elements in that document are
<span>affected by a base URL change</span>.</p>
<p>The <dfn export>document base URL</dfn> of a <code>Document</code> <var>document</var> is the
<span>URL record</span> obtained by running these steps:</p>

<p>The following are <span>base URL change steps</span>, which run when an element is
<span>affected by a base URL change</span> (as defined by <cite>DOM</cite>):</p>
<ol>
<li><p>If <var>document</var> has no <span>descendant</span> <code>base</code> element that has
an <code data-x="attr-base-href">href</code> attribute, then return <var>document</var>'s
<span>fallback base URL</span>.</p></li>

<dl class="switch">
<li><p>Otherwise, return the <span>frozen base URL</span> of the first <code>base</code> element
in <var>document</var> that has an <code data-x="attr-base-href">href</code> attribute, in
<span>tree order</span>.</p></li>
</ol>

<dt>If the element creates a <span>hyperlink</span></dt>
<p>The <dfn>fallback base URL</dfn> of a <code>Document</code> object <var>document</var> is the
<span>URL record</span> obtained by running these steps:</p>

<dd>
<p>If the <span>URL</span> identified by the hyperlink is being shown to the user, or if any
data derived from that <span>URL</span> is affecting the display, then the <code
data-x="attr-hyperlink-href">href</code> attribute's value should be <span
data-x="encoding-parsing a URL">reparsed</span>, relative to the element's <span>node
document</span> and the UI updated appropriately.</p>
<ol>
<li>
<p>If <var>document</var> is <span data-x="an iframe srcdoc document">an <code>iframe</code>
<code data-x="attr-iframe-srcdoc">srcdoc</code> document</span>:</p>

<p class="example">For example, the CSS <code data-x="selector-link">:link</code>/<code
data-x="selector-visited">:visited</code> <span data-x="pseudo-class">pseudo-classes</span>
might have been affected.</p>
<ol>
<li><p><span>Assert</span>: <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null.</p></li>

<p>If the hyperlink has a <code data-x="attr-hyperlink-ping">ping</code> attribute and its
<span data-x="URL">URL(s)</span> are being shown to the user, then the <code
data-x="attr-hyperlink-ping">ping</code> attribute's tokens should be <span
data-x="encoding-parsing a URL">reparsed</span>, relative to the element's <span>node
document</span> and the UI updated appropriately.</p>
</dd>
<li><p>Return <var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span>.</p></li>
</ol>
</li>

<dt>If the element is a <code>q</code>, <code>blockquote</code>, <code>ins</code>, or
<code>del</code> element with a <code data-x="">cite</code> attribute</dt>
<li><p>If <var>document</var>'s <span data-x="concept-document-url">URL</span> <span>matches
<code>about:blank</code></span> and <var>document</var>'s <span
data-x="concept-document-about-base-url">about base URL</span> is non-null, then return
<var>document</var>'s <span data-x="concept-document-about-base-url">about base
URL</span>.</p></li>

<dd>
<p>If the <span>URL</span> identified by the <code data-x="">cite</code> attribute is being
shown to the user, or if any data derived from that <span>URL</span> is affecting the display,
then the <code data-x="">cite</code> attribute's value should be <span data-x="encoding-parsing
a URL">reparsed</span>, relative to the element's <span>node document</span> and the UI updated
appropriately.</p>
</dd>
<!-- https://www.hixie.ch/tests/adhoc/dom/level0/history/pushState/001/ -->

<dt>Otherwise</dt>
<li><p>Return <var>document</var>'s <span data-x="concept-document-url">URL</span>.</p></li>
</ol>

<dd>
<p>The element is not directly affected.</p>
<hr>

<p class="example">For instance, changing the base URL doesn't affect the image displayed by
<code>img</code> elements, although subsequent accesses of the <code
data-x="dom-img-src">src</code> IDL attribute from script will return a new <span>absolute
URL</span> that might no longer correspond to the image being shown.</p>
</dd>
</dl>
<p>To <dfn>set the URL</dfn> for a <code>Document</code> <var>document</var> to a <span>URL
record</span> <var>url</var>:</p>

<ol>
<li><p>Set <var>document</var>'s <span data-x="concept-document-url">URL</span> to
<var>url</var>.</p></li>

<li><p><span>Respond to base URL changes</span> given <var>document</var>.</p></li>
</ol>

<p id="dynamic-changes-to-base-urls">To <dfn>respond to base URL changes</dfn> for a
<code>Document</code> <var>document</var>:</p>

<ol>
<li><p>The user agent should update any user interface elements which are displaying affected
URLs, or data derived from such URLs, to the user. Examples of such user interface elements would
be a status bar that displays a <span>hyperlink</span>'s <span
data-x="concept-hyperlink-url">url</span>, or some user interface which displays the URL
specified by a <code>q</code>, <code>blockquote</code>, <code>ins</code>, or <code>del</code>
element's <code data-x="">cite</code> attribute.</p></li>

<li><p>Ensure that the CSS <code data-x="selector-link">:link</code>/<code
data-x="selector-visited">:visited</code>/etc. <span data-x="pseudo-class">pseudo-classes</span>
are updated appropriately.</p></li>
</ol>

<p class="example" id="example-base-url-change-img-unaffected">This means that changing the base
URL doesn't affect, for example, the image displayed by <code>img</code> elements. Thus,
subsequent accesses of the <code data-x="dom-img-src">src</code> IDL attribute from script will
return a new <span>absolute URL</span> that might no longer correspond to the image being
shown.</p>

</div>

Expand Down Expand Up @@ -15279,6 +15264,8 @@ interface <dfn interface>HTMLBaseElement</dfn> : <span>HTMLElement</span> {
</li>

<li><p>Set <var>element</var>'s <span>frozen base URL</span> to <var>urlRecord</var>.</p></li>

<li><p><span>Respond to base URL changes</span> given <var>document</var>.</p></li>
</ol>

<p>The <dfn attribute for="HTMLBaseElement"><code data-x="dom-base-href">href</code></dfn> IDL
Expand Down Expand Up @@ -103093,8 +103080,7 @@ location.href = '#foo';</code></pre>
state</span> given <var>document</var> and <var>newEntry</var>.</p></li>

<li>
<p>Set <var>document</var>'s <span data-x="concept-document-url">URL</span> to
<var>newURL</var>.</p>
<p><span>Set the URL</span> given <var>document</var> to <var>newURL</var>.</p>

<p class="note">Since this is neither a <span data-x="navigate">navigation</span> nor a <span
data-x="traverse the history by a delta">history traversal</span>, it does not cause a <code
Expand Down