Skip to content

Commit

Permalink
Standardize the condition to open popup with window.open
Browse files Browse the repository at this point in the history
Fixes whatwg#5872

Define an "is popup" member in top-level browsing context, and set it to true
only when the browsing context is created by calling `window.open` with specific
combination of `features` parameter.

Also add non-normative notes/example for using popup UI depending on "is popup"
member.
  • Loading branch information
arai-a committed Oct 27, 2021
1 parent 3ad5159 commit bea517b
Showing 1 changed file with 125 additions and 0 deletions.
125 changes: 125 additions & 0 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2187,6 +2187,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
<li><dfn data-x-href="https://infra.spec.whatwg.org/#skip-ascii-whitespace">skip ASCII whitespace</dfn></li>
<li>The <dfn data-x-href="https://infra.spec.whatwg.org/#ordered-map">ordered map</dfn> data structure and the associated definitions for
<dfn data-x="map value" data-x-href="https://infra.spec.whatwg.org/#map-value">value</dfn>,
<dfn data-x="map empty" data-x-href="https://infra.spec.whatwg.org/#map-is-empty">empty</dfn>,
<dfn data-x="map entry" data-x-href="https://infra.spec.whatwg.org/#map-entry">entry</dfn>,
<dfn data-x="map exists" data-x-href="https://infra.spec.whatwg.org/#map-exists">exists</dfn>,
<dfn data-x="map get" data-x-href="https://infra.spec.whatwg.org/#map-get">getting the value of an entry</dfn>,
Expand Down Expand Up @@ -79502,6 +79503,24 @@ popup4.close();</code></pre></div>
<p>A <span>top-level browsing context</span> has an associated <dfn data-x="tlbc
group">group</dfn> (null or a <span>browsing context group</span>). It is initially null.</p>

<p>A <span>top-level browsing context</span> has an <dfn>is popup</dfn>
boolean. It is initially false.</p>

<p class="note">User agents can use <span>is popup</span> to decide what kind
of web browser interface to provide for the <span>browsing context</span>,
or provide an option to users to do or not do so.
</p>

<p class="example">For example, user agents can provide a minimal UI if
<span>is popup</span> is true. In the minimal UI, it's encouraged not to hide
the browser interface element that displays the <span>URL</span> or the
domain of the <span>active document</span>.</p>

<p class="note">User agents can use <span>is popup</span> to decide whether
to perform the <!--non-normative-->optional steps in
<span>set up browsing context features</span> steps or not,
or provide an option to users to do or not do so.</p>

<p>It is possible to create new browsing contexts that are related to a <span>top-level browsing
context</span> while their <span data-x="bc-container">container</span> is null. Such browsing
contexts are called <dfn data-x="auxiliary browsing context" data-lt="auxiliary browsing context"
Expand Down Expand Up @@ -80840,6 +80859,15 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
data-x="">new with no opener</code>", then:</p>

<ol>
<li>
<p>Let <var>isPopup</var> be the result of
<span data-x="popup-window-is-requested">checking if popup window is
requested</span>, given <var>tokenizedFeatures</var>.</p>
</li>
<li>
<p>Set the <var>target browsing context</var>'s <span>is popup</span> to
<var>isPopup</var>.</p>
</li>
<li><p><span>Set up browsing context features</span> for <var>target browsing context</var>
given <var>tokenizedFeatures</var>. <ref spec="CSSOMVIEW"></p></li>

Expand Down Expand Up @@ -81010,6 +81038,103 @@ dictionary <dfn dictionary>WindowPostMessageOptions</dfn> : <span>StructuredSeri
<li><p>Return <var>tokenizedFeatures</var>.</p></li>
</ol>

<p>To <dfn data-x="window-feature-is-set">check if window feature is
set</dfn>, given <var>tokenizedFeatures</var>, <var>featureName</var>, and
<var>defaultValue</var>:</p>

<ol>
<li>
<p>If <var>tokenizedFeatures</var>[<var>featureName</var>] <span data-x="map
exists">exists</span>, then:</p>

<ol>
<li>
<p>Return the result of
<span data-x="concept-window-open-features-parse-boolean">parsing
<var>tokenizedFeatures</var>[<var>featureName</var>] as a boolean
feature</span>.</p>
</li>
</ol>
</li>

<li><p>Return <var>defaultValue</var>.</p></li>
</ol>

<p>To <dfn data-x="popup-window-is-requested">check if popup window is
requested</dfn>, given <var>tokenizedFeatures</var>:</p>

<ol>
<li>
<p>If <var>tokenizedFeatures</var> is <span data-x="map empty">empty</span>,
then return false.</p>
</li>

<li>
<p>If <var>tokenizedFeatures</var>["<code data-x="">popup</code>"] <span
data-x="map exists">exists</span>, then return the result of
<span data-x="concept-window-open-features-parse-boolean">parsing
<var>tokenizedFeatures</var>["<code data-x="">popup</code>"] as a boolean
feature</span>.</p>
</li>

<li>
<p>Let <var>location</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
"<code data-x="">location</code>", and false.</p>
</li>

<li>
<p>Let <var>toolbar</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
"<code data-x="">toolbar</code>", and false.</p>
</li>

<li>
<p>If <var>location</var> and <var>toolbar</var> are both false, then
return true.</p>
</li>

<li>
<p>Let <var>menubar</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
<code data-x="">menubar</code>", and false.</p>
</li>

<li><p>If <var>menubar</var> is false, then return true.</p></li>

<li>
<p>Let <var>resizable</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
"<code data-x="">resizable</code>", and true.</p>
</li>

<li><p>If <var>resizable</var> is false, then return true.</p></li>

<li>
<p>Let <var>scrollbars</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
"<code data-x="">scrollbars</code>", and false.</p>
</li>

<li><p>If <var>scrollbars</var> is false, then return true.</p></li>

<li>
<p>Let <var>status</var> be the result of
<span data-x="window-feature-is-set">checking if window feature is
set</span>, given <var>tokenizedFeatures</var>,
"<code data-x="">status</code>", and false.</p>
</li>

<li><p>If <var>status</var> is false, then return true.</p></li>

<li><p>Return false.</p></li>
</ol>

<p>A code point is a <dfn>feature separator</dfn> if it is <span>ASCII whitespace</span>, U+003D
(=), or U+002C (,).</p>

Expand Down

0 comments on commit bea517b

Please sign in to comment.