Skip to content
Permalink
Browse files

[giow] (3) Make <base> elements not be affected by changes by to the …

…document's address

Fixing https://www.w3.org/Bugs/Public/show_bug.cgi?id=18459
Affected topics: HTML

git-svn-id: http://svn.whatwg.org/webapps@7962 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jun 12, 2013
1 parent b3886e1 commit b82dddec7eb2aa96e3c7009fc6a887840e3e40a3
Showing with 78 additions and 34 deletions.
  1. +24 −10 complete.html
  2. +24 −10 index
  3. +30 −14 source
</ol><p>The <dfn id=document-base-url>document base URL</dfn> of a <code><a href=#document>Document</a></code> object is the <a href=#absolute-url>absolute
URL</a> obtained by running these substeps:</p>

<ol><li><p>Let <var title="">fallback base url</var> be the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback
base URL</a>.</li>

<li><p>If there is no <code><a href=#the-base-element>base</a></code> element that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, then the <a href=#document-base-url>document base URL</a> is <var title="">fallback base url</var>; abort these steps. Otherwise, let <var title="">url</var> be
the value of the <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute of the first such
element.</li>

<li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> <var title="">url</var> relative to <var title="">fallback base url</var> (thus, the <code><a href=#the-base-element>base</a></code> <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute isn't affected by <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes).</li>
<ol><li><p>If there is no <code><a href=#the-base-element>base</a></code> element that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute in the <code><a href=#document>Document</a></code>, then the
<a href=#document-base-url>document base URL</a> is the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>;
abort these steps.</li>

<li><p>The <a href=#document-base-url>document base URL</a> is the result of the previous step if it was
successful; otherwise it is <var title="">fallback base url</var>.</li>
<li><p>Otherwise, the <a href=#document-base-url>document base URL</a> is the <a href=#frozen-base-url>frozen base URL</a> of the
first <code><a href=#the-base-element>base</a></code> element in the <code><a href=#document>Document</a></code> that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, in <a href=#tree-order>tree order</a>.</li>

</ol><div class=impl>

with <code title=attr-base-target><a href=#attr-base-target>target</a></code> attributes, all but
the first are ignored.</p>

<p>A <code><a href=#the-base-element>base</a></code> element that is the first <code><a href=#the-base-element>base</a></code> element with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in a particular <code><a href=#document>Document</a></code> has a
<dfn id=frozen-base-url>frozen base URL</dfn>. The <a href=#frozen-base-url>frozen base URL</a> must be <a href=#set-the-frozen-base-url title="set the frozen
base URL">set</a>, synchronously, whenever any of the following situations occur:</p>

<ul class=brief><li>The <code><a href=#the-base-element>base</a></code> element becomes the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
<code><a href=#document>Document</a></code>.</li>

<li>The <code><a href=#the-base-element>base</a></code> element is the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
<code><a href=#document>Document</a></code>, and its <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute is
changed.</li>

</ul><p>To <dfn id=set-the-frozen-base-url>set the <span>frozen base URL</span></dfn>, <a href=#resolve-a-url title="resolve a URL">resolve</a>
the value of the element's <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute relative to
the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>; if this is successful, set the
<a href=#frozen-base-url>frozen base URL</a> to the <a href=#resulting-absolute-url>resulting absolute URL</a>, otherwise, set the
<a href=#frozen-base-url>frozen base URL</a> to the <a href=#fallback-base-url>fallback base URL</a>.</p>

<p>The <dfn id=dom-base-href title=dom-base-href><code>href</code></dfn> IDL
attribute, on getting, must return the result of running the
following algorithm:
34 index
</ol><p>The <dfn id=document-base-url>document base URL</dfn> of a <code><a href=#document>Document</a></code> object is the <a href=#absolute-url>absolute
URL</a> obtained by running these substeps:</p>

<ol><li><p>Let <var title="">fallback base url</var> be the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback
base URL</a>.</li>

<li><p>If there is no <code><a href=#the-base-element>base</a></code> element that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, then the <a href=#document-base-url>document base URL</a> is <var title="">fallback base url</var>; abort these steps. Otherwise, let <var title="">url</var> be
the value of the <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute of the first such
element.</li>

<li><p><a href=#resolve-a-url title="resolve a URL">Resolve</a> <var title="">url</var> relative to <var title="">fallback base url</var> (thus, the <code><a href=#the-base-element>base</a></code> <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute isn't affected by <code title=attr-xml-base><a href=#the-xml:base-attribute-(xml-only)>xml:base</a></code> attributes).</li>
<ol><li><p>If there is no <code><a href=#the-base-element>base</a></code> element that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute in the <code><a href=#document>Document</a></code>, then the
<a href=#document-base-url>document base URL</a> is the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>;
abort these steps.</li>

<li><p>The <a href=#document-base-url>document base URL</a> is the result of the previous step if it was
successful; otherwise it is <var title="">fallback base url</var>.</li>
<li><p>Otherwise, the <a href=#document-base-url>document base URL</a> is the <a href=#frozen-base-url>frozen base URL</a> of the
first <code><a href=#the-base-element>base</a></code> element in the <code><a href=#document>Document</a></code> that has an <code title=attr-base-href><a href=#attr-base-href>href</a></code> attribute, in <a href=#tree-order>tree order</a>.</li>

</ol><div class=impl>

with <code title=attr-base-target><a href=#attr-base-target>target</a></code> attributes, all but
the first are ignored.</p>

<p>A <code><a href=#the-base-element>base</a></code> element that is the first <code><a href=#the-base-element>base</a></code> element with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in a particular <code><a href=#document>Document</a></code> has a
<dfn id=frozen-base-url>frozen base URL</dfn>. The <a href=#frozen-base-url>frozen base URL</a> must be <a href=#set-the-frozen-base-url title="set the frozen
base URL">set</a>, synchronously, whenever any of the following situations occur:</p>

<ul class=brief><li>The <code><a href=#the-base-element>base</a></code> element becomes the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
<code><a href=#document>Document</a></code>.</li>

<li>The <code><a href=#the-base-element>base</a></code> element is the first <code><a href=#the-base-element>base</a></code> element in <a href=#tree-order>tree
order</a> with an <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute in its
<code><a href=#document>Document</a></code>, and its <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute is
changed.</li>

</ul><p>To <dfn id=set-the-frozen-base-url>set the <span>frozen base URL</span></dfn>, <a href=#resolve-a-url title="resolve a URL">resolve</a>
the value of the element's <code title=attr-base-href><a href=#attr-base-href>href</a></code> content attribute relative to
the <code><a href=#document>Document</a></code>'s <a href=#fallback-base-url>fallback base URL</a>; if this is successful, set the
<a href=#frozen-base-url>frozen base URL</a> to the <a href=#resulting-absolute-url>resulting absolute URL</a>, otherwise, set the
<a href=#frozen-base-url>frozen base URL</a> to the <a href=#fallback-base-url>fallback base URL</a>.</p>

<p>The <dfn id=dom-base-href title=dom-base-href><code>href</code></dfn> IDL
attribute, on getting, must return the result of running the
following algorithm:
44 source
@@ -5934,22 +5934,14 @@ a.setAttribute('href', 'http://example.com/'); // change the content attribute d

<ol>

<li><p>Let <var title="">fallback base url</var> be the <code>Document</code>'s <span>fallback
base URL</span>.</p></li>

<li><p>If there is no <code>base</code> element that has an <code
title="attr-base-href">href</code> attribute, then the <span>document base URL</span> is <var
title="">fallback base url</var>; abort these steps. Otherwise, let <var title="">url</var> be
the value of the <code title="attr-base-href">href</code> attribute of the first such
element.</p></li>

<li><p><span title="resolve a URL">Resolve</span> <var title="">url</var> relative to <var
title="">fallback base url</var> (thus, the <code>base</code> <code
title="attr-base-href">href</code> attribute isn't affected by <code
title="attr-xml-base">xml:base</code> attributes).</p></li>
title="attr-base-href">href</code> attribute in the <code>Document</code>, then the
<span>document base URL</span> is the <code>Document</code>'s <span>fallback base URL</span>;
abort these steps.</p></li>

<li><p>The <span>document base URL</span> is the result of the previous step if it was
successful; otherwise it is <var title="">fallback base url</var>.</p></li>
<li><p>Otherwise, the <span>document base URL</span> is the <span>frozen base URL</span> of the
first <code>base</code> element in the <code>Document</code> that has an <code
title="attr-base-href">href</code> attribute, in <span>tree order</span>.</p></li>

</ol>

with <code title="attr-base-target">target</code> attributes, all but
the first are ignored.</p>

<p>A <code>base</code> element that is the first <code>base</code> element with an <code
title="attr-base-href">href</code> content attribute in a particular <code>Document</code> has a
<dfn>frozen base URL</dfn>. The <span>frozen base URL</span> must be <span title="set the frozen
base URL">set</span>, synchronously, whenever any of the following situations occur:</p>

<ul class="brief">

<li>The <code>base</code> element becomes the first <code>base</code> element in <span>tree
order</span> with an <code title="attr-base-href">href</code> content attribute in its
<code>Document</code>.</li>

<li>The <code>base</code> element is the first <code>base</code> element in <span>tree
order</span> with an <code title="attr-base-href">href</code> content attribute in its
<code>Document</code>, and its <code title="attr-base-href">href</code> content attribute is
changed.</li>

</ul>

<p>To <dfn>set the <span>frozen base URL</span></dfn>, <span title="resolve a URL">resolve</span>
the value of the element's <code title="attr-base-href">href</code> content attribute relative to
the <code>Document</code>'s <span>fallback base URL</span>; if this is successful, set the
<span>frozen base URL</span> to the <span>resulting absolute URL</span>, otherwise, set the
<span>frozen base URL</span> to the <span>fallback base URL</span>.</p>

<p>The <dfn title="dom-base-href"><code>href</code></dfn> IDL
attribute, on getting, must return the result of running the
following algorithm:

0 comments on commit b82ddde

Please sign in to comment.
You can’t perform that action at this time.