-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Centralize checks for <a>, <area>, <form>, and <link> #2613
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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> | ||
|
||
|
||
|
||
|
@@ -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> | ||
|
@@ -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> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. FYI https://english.stackexchange.com/questions/204006/cannot-vs-can-not since my brain momentarily started thinking "cannot" is weird. (TLDR: it's correct.) |
||
|
||
<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> | ||
|
||
|
@@ -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 | ||
|
@@ -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 | ||
|
@@ -55722,19 +55716,13 @@ 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> | ||
<!-- We check for "cannot navigate" below again as dispatching the submit event can change the | ||
outcome of that check. --> | ||
|
||
<p class="XXX">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 | ||
|
@@ -55761,7 +55749,9 @@ 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></li> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should we expand the HTML comment here into a visible note? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess we could. |
||
</ol> | ||
|
||
<!-- if you add any steps between the "lock" and "unlock" lines, make sure to update the step | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This section is full of double negatives ("an element cannot navigate if it's node document is not fully active"), but I think it's pretty nice at the call sites, so I'm not sure what to do. I guess you could define "can navigate" and then say "cannot navigate = the negation of can navigate".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather just leave it as-is unless we get more complaints. Or until we turn everything into abstract operations, if ever.