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 May 3, 2017
1 parent eb31d93 commit 5cd556f
Showing 1 changed file with 18 additions and 29 deletions.
47 changes: 18 additions & 29 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -13400,19 +13400,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 @@ -19182,12 +19173,7 @@ interface <dfn>HTMLAnchorElement</dfn> : <span>HTMLElement</span> {
<p>The <span>activation behavior</span> of <code>a</code> elements that create <span
data-x="hyperlink">hyperlinks</span> is to run the following steps:</p>

<ol><!-- c.f. <area>'s similar section, also <link>'s -->

<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 -->

<ol><!-- c.f. <link> and <area>'s similar section -->
<li>

<p>If the user has not indicated a specific <span>browsing context</span> for following the
Expand Down Expand Up @@ -22768,11 +22754,19 @@ interface <dfn>HTMLHyperlinkElementUtils</dfn> {

<h4>Following hyperlinks</h4>

<p>An element <var>element</var> <dfn>cannot navigate</dfn> if <var>element</var>'s <span>node
document</span> is not <span>fully active</span> or <var>element</var> is not
<span>connected</span>.

<p class="note">This is also used by <span data-x="concept-form-submit">form submission</span> for
the <code>form</code> element.</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 @@ -22880,6 +22874,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 @@ -38254,11 +38249,7 @@ interface <dfn>HTMLAreaElement</dfn> : <span>HTMLElement</span> {
<p>The <span>activation behavior</span> of <code>area</code> elements is to run the following
steps:</p>

<ol><!-- c.f. <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>

<ol><!-- c.f. <link> and <a>'s similar section -->
<li>

<p>If the user has not indicated a specific <span>browsing context</span> for following the
Expand Down Expand Up @@ -55289,14 +55280,12 @@ fur
following steps:</p>

<ol>
<li><p>If <var>form</var> <span>cannot navigate</span>, then return.</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> is not <span>connected</span>, has
no associated <span data-x="concept-document-bc">browsing context</span>, or its <span>active
sandboxing flag set</span> has its <span>sandboxed forms browsing context flag</span> set, then
abort these steps without doing anything.</p></li>
<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
context</span> of <var>form document</var>.</p></li>
Expand Down

0 comments on commit 5cd556f

Please sign in to comment.