Skip to content

Commit

Permalink
Centralize checks for <a>, <area>, <form>, and <link>
Browse files Browse the repository at this point in the history
Require that they are all connected to a document that is fully
active. There is enough difference between implementations that this
appears to be web compatible.

Tests:

* web-platform-tests/wpt#5758
* web-platform-tests/wpt#5759
* web-platform-tests/wpt#5761

Fixes #2615.
  • Loading branch information
annevk committed Aug 23, 2017
1 parent f8a2124 commit dd32b3d
Showing 1 changed file with 25 additions and 39 deletions.
64 changes: 25 additions & 39 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13488,19 +13488,10 @@ interface <dfn>HTMLLinkElement</dfn> : <span>HTMLElement</span> {
<p>User agents could also include other information, such as the type of the resource (as given by
the <code data-x="attr-link-type">type</code> attribute).</p>

<!-- c.f. <a> and <area>'s similar sections -->
<p>The <span>activation behavior</span> of <code>link</code> elements that create <span
data-x="hyperlink">hyperlinks</span> is to run the following steps:</p>

<ol><!-- c.f. <a> and <area>'s similar sections -->

<li><p>If the <code>link</code> element's <span>node document</span> is not <span>fully
active</span>, then abort these steps.</p></li>

<li><p><span data-x="following hyperlinks">Follow the hyperlink</span> created by the
<code>link</code> element.</p></li>

</ol>

data-x="hyperlink">hyperlinks</span> is to <span data-x="following hyperlinks">follow the
hyperlink</span> created by the <code>link</code> element.</p>



Expand Down Expand Up @@ -19360,10 +19351,6 @@ interface <dfn>HTMLAnchorElement</dfn> : <span>HTMLElement</span> {
data-x="hyperlink">hyperlinks</span> is to run the following steps:</p>

<ol><!-- c.f. <link> and <area>'s similar section -->
<li><p>If the <code>a</code> element's <span>node document</span> is not <span>fully active</span>, then abort these steps.</p></li>
<!-- https://software.hixie.ch/utilities/js/live-dom-viewer/?saved=2033 -->
<!-- https://www.hixie.ch/tests/adhoc/html/navigation/iframe/002.html -->

<li><p>If the target of the <code data-x="event-click">click</code> event is an <code>img</code>
element with an <code data-x="attr-img-ismap">ismap</code> attribute specified, then server-side
image map processing must be performed, as follows:</p>
Expand Down Expand Up @@ -22935,11 +22922,23 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {

<h4>Following hyperlinks</h4>

<p>An element <var>element</var> <dfn>cannot navigate</dfn> if one of the following is true:</p>

<ul class="brief">
<li><var>element</var>'s <span>node document</span> is not <span>fully active</span></li>
<li><var>element</var> is not an <code>a</code> element and is not <span>connected</span>.</li>
</ul>

<p class="note">This is also used by <span data-x="concept-form-submit">form submission</span> for
the <code>form</code> element. The exception for <code>a</code> elements is for compatibility with
web content.</p>

<p>When a user <dfn data-x="following hyperlinks">follows a hyperlink</dfn> created by an element
<var>subject</var>, optionally with a <var>hyperlink suffix</var>, the user agent must run the
following steps:</p>

<ol>
<li><p>If <var>subject</var> <span>cannot navigate</span>, then return.</p></li>

<li><p>Let <var>replace</var> be false.</p></li>

Expand Down Expand Up @@ -23038,6 +23037,7 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {
run the following steps:</p>

<ol>
<li><p>If <var>subject</var> <span>cannot navigate</span>, then return.</p></li>

<li><p><span data-x="parse a url">Parse</span> the <span>URL</span> given by
<var>subject</var>'s <code data-x="attr-hyperlink-href">href</code> attribute, relative to
Expand Down Expand Up @@ -38616,18 +38616,12 @@ interface <dfn>HTMLAreaElement</dfn> : <span>HTMLElement</span> {

<div w-nodev>

<p>The <span>activation behavior</span> of <code>area</code> elements is to run the following
steps:</p>

<ol><!-- c.f. <link> and <a>'s similar section -->
<li><p>If the <code>area</code> element's <span>node document</span> is not <span>fully
active</span>, then abort these steps.</p></li>

<li><p><span data-x="following hyperlinks">Follow the hyperlink</span> or <span
data-x="downloading hyperlinks">download the hyperlink</span> created by the <code>area</code>
element, if any, and as determined by the <code data-x="attr-hyperlink-download">download</code>
attribute and any expressed user preference.</p></li>
</ol>
<!-- c.f. <link> and <a>'s similar section -->
<p>The <span>activation behavior</span> of <code>area</code> elements is to <span
data-x="following hyperlinks">Follow the hyperlink</span> or <span data-x="downloading
hyperlinks">download the hyperlink</span> created by the <code>area</code> element, if any, and as
determined by the <code data-x="attr-hyperlink-download">download</code> attribute and any
expressed user preference.</p>

<p>The IDL attributes <dfn><code data-x="dom-area-alt">alt</code></dfn>, <dfn><code
data-x="dom-area-coords">coords</code></dfn>, <dfn><code
Expand Down Expand Up @@ -55722,19 +55716,11 @@ fur
following steps:</p>

<ol>
<li>
<p>If <var>form</var> is not <span>connected</span>, then return.</p>
<li><p>If <var>form</var> <span>cannot navigate</span>, then return.</p></li>

<p class="&#x0058;&#x0058;&#x0058;">This check is currently under discussion, and may be
either removed or expanded. See <a href="https://github.com/whatwg/html/issues/2615">issue
#2615</a> and <a href="https://github.com/whatwg/html/issues/2708">issue #2708</a>.</p>
</li>

<li><p>Let <var>form document</var> be the <var>form</var>'s
<span>node document</span>.</p></li>
<li><p>Let <var>form document</var> be <var>form</var>'s <span>node document</span>.</p></li>

<li id="sandboxSubmitBlocked"><p>If <var>form document</var> has no associated <span
data-x="concept-document-bc">browsing context</span>, or its <span>active sandboxing flag
<li id="sandboxSubmitBlocked"><p>If <var>form document</var>'s <span>active sandboxing flag
set</span> has its <span>sandboxed forms browsing context flag</span> set, then return.</p></li>

<li><p>Let <var>form browsing context</var> be the <span data-x="concept-document-bc">browsing
Expand Down

0 comments on commit dd32b3d

Please sign in to comment.