Skip to content
This repository has been archived by the owner on Jul 30, 2019. It is now read-only.

Commit

Permalink
Fix #523: port noopener (#800)
Browse files Browse the repository at this point in the history
  • Loading branch information
travisleithead authored and arronei committed Feb 17, 2017
1 parent 6c81d06 commit 318147e
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 14 deletions.
10 changes: 8 additions & 2 deletions sections/browsers.include
Expand Up @@ -1261,9 +1261,15 @@

</li>

<li><i>End</i>: Return the <code>WindowProxy</code> object of <var>target browsing
context</var>.</li>
<li><i>End</i>:

<ol>
<li>If the result of <a lt="split a string on commas">splitting |features| on commas</a>
contains the token "`noopener`", then
<a lt="disowned its opener">disown |target browsing context|'s opener</a> and return null.</li>

<li>Otherwise, return the {{WindowProxy}} object of |target browsing context|.</li>
</ol></li>
</ol>

<hr />
Expand Down
36 changes: 24 additions & 12 deletions sections/semantics-links.include
Expand Up @@ -86,9 +86,8 @@
<a>supported tokens</a> are the keywords defined in
<a>HTML link types</a> which are allowed on <{a}> and
<{area}> elements, impact the processing model, and are supported by the user agent. The
possible supported tokens are
<a attr-value for="link/type"><code>noreferrer</code></a>, and
<code>noopener</code>.
possible <a>supported tokens</a> are
<{link/type/noreferrer}>, and <{link/type/noopener}>.
<{links/rel}>'s
<a>supported tokens</a> must only include the tokens from
this list that the user agent implements the processing model for.
Expand Down Expand Up @@ -628,6 +627,9 @@

</li>

<li>If |subject|'s [=link types=] include the `noreferrer` or <{link/type/noopener}> keyword,
and |replace| is true, then [=disowned its opener|disown target's opener=].</li>

<li><a>Parse</a> the [=url/URL=] given by
<var>subject</var>'s <{links/href}> attribute, relative to
<var>subject</var>'s <a>node document</a>.</li>
Expand Down Expand Up @@ -981,11 +983,11 @@
</tr>

<tr>
<td><code>noopener</code></td>
<td><{link/type/noopener}></td>
<td><em>not allowed</em></td>
<td><a>Annotation</a></td>
<td class="no"> &middot; </td>
<td>Requires that any <a>browsing context</a> created by following the hyperlink must not have an <a>opener browsing context</a>.</td>
<td>Requires that any <a>browsing context</a> created by following the hyperlink to [=disowned its opener|disown its opener=].</td>
</tr>

<tr>
Expand Down Expand Up @@ -1441,16 +1443,26 @@

It indicates that no referrer information is to be leaked when following the link.

<div class="impl">

If a user agent follows a link defined by an <{a}> or <{area}> element that
has the <a attr-value for="link/type"><code>noreferrer</code></a> keyword, the user agent must set their
<a>request</a>'s <a>referrer</a> to "<code>no-referrer</code>".

This keyword also <a>causes the <code>opener</code>
attribute to remain null</a> if the hyperlink creates a new <a>browsing context</a>.
<p class="note">For historical reasons, the <{link/type/noreferrer}> keyword implies the behavior
associated with the <{link/type/noopener}> keyword when present on a hyperlink that
[=creating a new browsing context|creates=] a new [=browsing context=]. That is,
<code highlight="html">&lt;a href="..." rel="noreferrer" target="_blank"></code> has the same
behavior as
<code highlight="html">&lt;a href="..." rel="noreferrer noopener" target="_blank"></code>.</p>

</div>
<h5 id="link-type-noopener">Link type "<dfn attr-value for="link/type"><code>noopener</code></dfn>"</h5>

The <{link/type/noopener}> keyword may be used with <{a}> and <{area}> elements. This keyword does
not create a [=hyperlink=], but [=annotates=] any other hyperlinks created by the element (the
implied hyperlink, if no other keywords create one).

The keyword indicates that any newly created [=browsing context=] which results from following the
[=hyperlink=] will have [=disowned its opener=], which means that its
{{Window/opener|window.opener}} property will be `null`.

<h5 id="link-type-search">Link type "<dfn attr-value for="link/type"><code>search</code></dfn>"</h5>

Expand Down Expand Up @@ -1566,8 +1578,8 @@

The CSS <a>environment encoding</a> is the result of running the following steps: [[!CSS-SYNTAX-3]]

1. If the element has a <code>charset</code> attribute,
<a lt="getting an encoding">get an encoding</a> from that attribute's value. If that
1. If the element has a <code>charset</code> attribute,
<a lt="getting an encoding">get an encoding</a> from that attribute's value. If that
succeeds, return the resulting encoding and abort these steps. [[!ENCODING]]
2. Otherwise, return the <a>document's character encoding</a>. [[!DOM]]
</div>
Expand Down

0 comments on commit 318147e

Please sign in to comment.