Skip to content

Commit

Permalink
Editorial: centralize target attribute processing
Browse files Browse the repository at this point in the history
Fixes #2619.
  • Loading branch information
annevk authored Sep 6, 2017
1 parent 8f719cd commit 0b31844
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -12837,6 +12837,23 @@ interface <dfn>HTMLBaseElement</dfn> : <span>HTMLElement</span> {
<p class="note">If there are multiple <code>base</code> elements with <code
data-x="attr-base-target">target</code> attributes, all but the first are ignored.</p>

<p>To <dfn>get an element's target</dfn>, given an <code>a</code>, <code>area</code>, or
<code>form</code> element <var>element</var>, run these steps:

<ol>
<li><p>If <var>element</var> has a <code data-x="">target</code> attribute, then return that
attribute's value.</p></li>

<li><p>If <var>element</var>'s <span>node document</span> contains a <code>base</code> element
with a <code data-x="attr-base-target">target</code> attribute, then return the value of the
<code data-x="attr-base-target">target</code> attribute of the first such <code>base</code>
element.</p></li>

<li><p>Return null.</p></li>
</ol>

<hr>

<p>A <code>base</code> element that is the first <code>base</code> element with an <code
data-x="attr-base-href">href</code> content attribute <span>in a document tree</span> has a
<dfn>frozen base URL</dfn>. The <span>frozen base URL</span> must be <span>immediately</span>
Expand Down Expand Up @@ -22944,17 +22961,9 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {

<li><p>Let <var>targetAttributeValue</var> be null.</p></li>

<li><p>If <var>subject</var> is an <code>a</code> or <code>area</code> element that has a <code
data-x="attr-hyperlink-target">target</code> attribute, then set <var>targetAttributeValue</var>
to that attribute's value.</p></li>

<li><p>Otherwise, if <var>subject</var> is an <code>a</code> or <code>area</code> element with no
<code data-x="attr-hyperlink-target">target</code> attribute, but <var>subject</var>'s <span>node
document</span> contains a <code>base</code> element with a <code
data-x="attr-base-target">target</code> attribute, then set <var>targetAttributeValue</var> to
the value of <code data-x="attr-base-target">target</code> attribute of the first such
<code>base</code> element.</p></li>
<!-- c.f. concept-fs-target -->
<li><p>If <var>subject</var> is an <code>a</code> or <code>area</code> element, then set
<var>targetAttributeValue</var> to the result of <span data-x="get an element's target">getting
an element's target</span> given <var>subject</var>.</p></li>

<li><p>Let <var>noopener</var> be true if <var>subject</var>'s <a href="#linkTypes">link
types</a> include the <code data-x="rel-noreferrer">noreferrer</code>
Expand Down Expand Up @@ -52713,19 +52722,10 @@ interface <dfn>HTMLLegendElement</dfn> : <span>HTMLElement</span> {

<hr>

<p>The <dfn><code data-x="attr-fs-target">target</code></dfn> and <dfn><code data-x="attr-fs-formtarget">formtarget</code></dfn> content attributes, if specified, must
have values that are <span data-x="valid browsing context name or keyword">valid browsing context
names or keywords</span>.</p>

<p>The <dfn data-x="concept-fs-target">target</dfn> of an element is the value of the element's
<code data-x="attr-fs-formtarget">formtarget</code> attribute, if the element is a <span
data-x="concept-submit-button">submit button</span> and has such an attribute; or the value of its
<span>form owner</span>'s <code data-x="attr-fs-target">target</code> attribute, if <em>it</em>
has such an attribute; or, if the element's <span>node document</span> contains a
<code>base</code> element with a <code data-x="attr-base-target">target</code> attribute, then the
value of the <code data-x="attr-base-target">target</code> attribute of the first such
<code>base</code> element; or, if there is no such element, null.</p>
<!-- c.f. hyperlink following -->
<p>The <dfn><code data-x="attr-fs-target">target</code></dfn> and <dfn><code
data-x="attr-fs-formtarget">formtarget</code></dfn> content attributes, if specified, must have
values that are <span data-x="valid browsing context name or keyword">valid browsing context names
or keywords</span>.</p>

<hr>

Expand Down Expand Up @@ -55802,8 +55802,11 @@ fur
<li><p>Let <var>method</var> be the <var>submitter</var> element's <span
data-x="concept-fs-method">method</span>.</p></li>

<li><p>Let <var>target</var> be the <var>submitter</var> element's <span
data-x="concept-fs-target">target</span>.</p></li>
<li><p>Let <var>target</var> be the <var>submitter</var> element's <code
data-x="attr-fs-formtarget">formtarget</code> attribute value, if the element is a <span
data-x="concept-submit-button">submit button</span> and has such an attribute. Otherwise, let it
be the result of <span data-x="get an element's target">getting an element's target</span> given
<var>submitter</var>'s <span>form owner</span>.</p></li>

<li><p>Let <var>target browsing context</var> and <var>replace</var> be the result of applying
<span>the rules for choosing a browsing context</span> using <var>target</var> and <var>form
Expand Down

0 comments on commit 0b31844

Please sign in to comment.