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 (except for <a>) that is fully active (including <a>). There is enough difference between implementations that this appears to be web compatible.

Also perform a second connected check for <form>.

Tests:

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

Fixes #2615 and fixes #2708.
  • Loading branch information
annevk authored Sep 22, 2017
1 parent 7df2378 commit f3c354a
Showing 1 changed file with 33 additions and 40 deletions.
73 changes: 33 additions & 40 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13633,19 +13633,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 @@ -19475,10 +19466,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 @@ -23050,11 +23037,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 @@ -23147,6 +23146,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 @@ -38591,18 +38591,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 @@ -55687,19 +55681,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 <var>form</var>'s <span>node document</span>.</p></li>

<li><p>Let <var>form document</var> be the <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 All @@ -55726,7 +55712,14 @@ fur
<code data-x="dom-Event-bubbles">bubbles</code> attribute initialized to true and the <code
data-x="dom-Event-cancelable">cancelable</code> attribute initialized to true.</p></li>

<li><p>If <var>continue</var> is false, then abort these steps.
<li><p>If <var>continue</var> is false, then return.</p></li>

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

<p class="note"><span>Cannot navigate</span> is run again as dispatching the <code
data-x="event-submit">submit</code> event could have changed the outcome.</p>
</li>
</ol>

<!-- if you add any steps between the "lock" and "unlock" lines, make sure to update the step
Expand Down

0 comments on commit f3c354a

Please sign in to comment.