Skip to content

Commit

Permalink
Specify the tokenizer for window.open's features argument
Browse files Browse the repository at this point in the history
This was specified in CSSOM View but the "noopener" feature did
not use the same tokenizer as the legacy features. Fixes #2474.

Also specify the aliases screenx, screeny, innerwidth, innerheight
for left, top, width, and height, respectively. Part of #2464.
Closes w3c/csswg-drafts#1128.
  • Loading branch information
zcorpan committed Mar 27, 2017
1 parent 2312f72 commit 5269fd9
Showing 1 changed file with 68 additions and 6 deletions.
74 changes: 68 additions & 6 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -78669,8 +78669,11 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span
indicating a preference for navigating a new <span>top-level browsing context</span>, then let
<var>new</var> be true. Otherwise, let it be false.</p></li>

<li><p>Interpret <var>features</var> <span data-x="dom-open-features">as defined in the CSSOM
View specification</span>. <ref spec="CSSOMVIEW"></p></li>
<li><p>Let <var>tokenizedFeatures</var> be the result of <span
data-x="concept-window-open-features-tokenize">tokenizing</span> <var>features</var>.</p></li>

<li><p>Interpret <var>tokenizedFeatures</var> <span data-x="dom-open-features">as defined in the
CSSOM View specification</span>. <ref spec="CSSOMVIEW"></p></li>

<li>

Expand Down Expand Up @@ -78725,10 +78728,9 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span

<ol>

<li><p>If the result of <span data-x="split a string on commas">splitting <var>features</var>
on commas</span> contains the token "<code data-x="">noopener</code>", then <span
data-x="disowned its opener">disown <var>target browsing context</var>'s opener</span> and
return null.</p></li>
<li><p>If <var>tokenizedFeatures</var> <span data-x="map exists">contains</span> an entry with
the key "<code data-x="">noopener</code>", then <span data-x="disowned its opener">disown
<var>target browsing context</var>'s opener</span> and return null.</p></li>

<li><p>Otherwise, return the <code>WindowProxy</code> object of <var>target browsing
context</var>.</p></li>
Expand All @@ -78739,6 +78741,66 @@ callback <dfn>FrameRequestCallback</dfn> = void (<span>DOMHighResTimeStamp</span

</ol>

<p>To <dfn data-x="concept-window-open-features-tokenize">tokenize the <var>features</var>
argument</dfn>:</p>

<ol>
<li><p>Let <var>tokens</var> be the result of <span data-x="split a string on commas">splitting
<var>features</var> on commas</span>.</p></li>

<li><p>Let <var>map</var> be a new <span>ordered map</span>.</p></li>

<li>
<p>For each <var>token</var> of <var>tokens</var>:</p>
<ol>
<li><p>Let <var>input</var> be <var>token</var>.

<li><p>Let <var>position</var> point at the first character of <var>input</var>.</p></li>

<li><p><span>Skip ASCII whitespace</span>.

<li><p><span>Collect a sequence of code points</span> that are not <span>ASCII
whitespace</span> nor U+003D (=). Let <var>name</var> be the collected characters,
<span>converted to ASCII lowercase</span>.</p></li>

<li><p>Set <var>name</var> to the result of <span>normalizing the feature name</span>
<var>name</var>.</p></li>

<li><p>If <var>tokenizedFeatures</var>[<var>name</var>] <span data-x="map
exists">exists</span>, then continue.</p></li>

<li><p><span>Skip ASCII whitespace</span>.</p></li>

<li><p>If the character at <var>position</var> is U+003D (=), then advance <var>position</var>
by 1.</p></li>

<li><p>Let <var>value</var> be the empty string.</p></li>

<li><p>If <var>position</var> is not past the end of <var>input</var>, then <span>collect a
sequence of code points</span> that are any characters. Set <var>value</var> to the collected
characters.</p></li>

<li><p>Set <var>tokenizedFeatures</var>[<var>name</var>] to <var>value</var>.</p></li>
</ol>
</li>
</ol>

<p>For legacy reasons, there are some aliases of some feature names. To <dfn data-x="normalizing
the feature name">normalize a feature name</dfn> <var>name</var>, switch on <var>name</var>:</p>

<dl class="switch">
<dt>"<code data-x="">screenx</code>"
<dd>Return "<code data-x="">left</code>".
<dt>"<code data-x="">screeny</code>"
<dd>Return "<code data-x="">top</code>".
<dt>"<code data-x="">innerwidth</code>"
<dd>Return "<code data-x="">width</code>".
<dt>"<code data-x="">innerheight</code>"
<dd>Return "<code data-x="">height</code>".
<dt>Anything else
<dd>Return <var>name</var>.
</dl>

<hr>

<p>The <dfn><code data-x="dom-name">name</code></dfn> attribute of the <code>Window</code> object
Expand Down

0 comments on commit 5269fd9

Please sign in to comment.