Skip to content
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

Implement undefined-like exotic objects #673

Merged
merged 10 commits into from
Aug 18, 2017
54 changes: 54 additions & 0 deletions spec.html
Original file line number Diff line number Diff line change
Expand Up @@ -39904,6 +39904,60 @@ <h1>Initializers in ForIn Statement Heads</h1>
1. Return ? ForIn/OfBodyEvaluation(|BindingIdentifier|, |Statement|, _keyResult_, ~enumerate~, ~varBinding~, _labelSet_).
</emu-alg>
</emu-annex>

<emu-annex id="sec-IsHTMLDDA-internal-slot">
<h1>The [[IsHTMLDDA]] Internal Slot</h1>
<p>An <dfn>[[IsHTMLDDA]] internal slot</dfn> may exist on implementation-defined objects. Objects with an [[IsHTMLDDA]] internal slot behave like *undefined* in the <emu-xref href="#sec-toboolean">ToBoolean</emu-xref> and <emu-xref href="#sec-abstract-equality-comparison">Abstract Equality Comparison</emu-xref> abstract operations and when used as an operand for the <emu-xref href="#sec-typeof-operator">`typeof` operator</emu-xref>.</p>
<emu-note>
<p>Objects with an [[IsHTMLDDA]] internal slot are never created by this specification. However, the <a href="https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-all"><code>document.all</code> object</a> in web browsers is a host-created exotic object with this slot that exists for web compatibility purposes. There are no other known examples of this type of object and implementations should not create any with the exception of `document.all`.</p>
</emu-note>

<emu-annex id="sec-IsHTMLDDA-internal-slot-to-boolean">
<h1>Changes to ToBoolean</h1>
<p>The result column in <emu-xref href="#table-10"></emu-xref> for an argument type of Object is replaced with the following algorithm:</p>
<emu-alg>
1. If _argument_ has an [[IsHTMLDDA]] internal slot, return *false*.
1. Return *true*.
</emu-alg>
</emu-annex>

<emu-annex id="sec-IsHTMLDDA-internal-slot-aec">
<h1>Changes to Abstract Equality Comparison</h1>
<p>The following steps are inserted after step 3 of the <emu-xref href="#sec-abstract-equality-comparison">Abstract Equality Comparison</emu-xref> algorithm:</p>
<emu-alg>
1. If _x_ has an [[IsHTMLDDA]] internal slot and _y_ is either *null* or *undefined*, return *true*.
1. If _x_ is either *null* or *undefined* and _y_ has an [[IsHTMLDDA]] internal slot, return *true*.
</emu-alg>
</emu-annex>

<emu-annex id="sec-IsHTMLDDA-internal-slot-typeof">
<h1>Changes to the `typeof` operator</h1>
<p>The following table entry is inserted into <emu-xref href="#table-35"></emu-xref> immediately preceeding the entry for "Object (implements [[Call]])":</p>
<emu-table>
<emu-caption>
Additional <emu-xref href="#sec-typeof-operator">`typeof`</emu-xref> Operator Results
</emu-caption>
<table>
<tr>
<th>
Type of _val_
</th>
<th>
Result
</th>
</tr>
<tr>
<td>
Object (has an [[IsHTMLDDA]] internal slot)
</td>
<td>
`"undefined"`
</td>
</tr>
</table>
</emu-table>
</emu-annex>
</emu-annex>
</emu-annex>
</emu-annex>

Expand Down