-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Changes from 5 commits
485b19e
a220ecd
7dbcec4
0867cfa
3e98c42
3e419ce
5b82c3c
3988f9e
7007015
0a1ee49
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 |
---|---|---|
|
@@ -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> | ||
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. Uppercase to match other internal slot names? |
||
<p>An <dfn>[[isHTMLDDA]] internal slot</dfn> may exist on implementation-defined exotic objects. Objects with an [[isHTMLDDA]] intenral 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> | ||
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.
It looks like
This isn't quite right, as HTML will define one with overridden internal methods. Not sure what the right phrasing is... "By default, ... (but other specifications may create HTML document dot all exotic objects with overridden internal methods)"? 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. Maybe one way to do this would be to state somehow that any object (well, one precise object) can be "marked" as a HTML document dot all exotic object, not that it "is" a HTML dot all exotic object. That way it could be a "legacy platform exotic object" (= using various internal methods defined by Web IDL) plus be marked as a HTML document dot all exotic object, at the same time. 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. Typo "intenrel" typeof still not codeified. Actually just using title="" attribute might work better? For most of these xrefs? Maybe even it's not required at all for ToBoolean? 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.
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. It should be “object(s)” rather than “exotic object(s)” (here and everywhere below). Although the behaviour described in this section is very “exotic” according the common meaning of that word, it does not make an exotic object in the sense of the definition given by the spec. 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 think it's still fair, since 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 think @claudepache is right - the object may be exotic depending on host choices, but it's confusing to say its exotic when it doesn't define anything exotic. Might trigger someone to go sleuthing for hours trying to find the missing exoticness. I'll fix it. |
||
<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> | ||
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. Maybe add a requirement on hosts? s/this type of object/and none must be introduced/ 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. This was discussed somewhat, I think there was resistance to "overreach", but I'm definitely fine with the note saying something to this effect. 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. Wouldn't it be better to point to 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. Also, why not must not? 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 think document.all is better. There's nothing special about HTMLAllCollection itself, really. Its instances are the weird ones. And a good way of collectively referring to all such instances is probably "document.all". 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. @annevk I only went with "should" because this is a note and it seems odd to use strong language in a non-normative section. |
||
</emu-note> | ||
|
||
<emu-annex id="sec-html-document-dot-all-exotic-object-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*. | ||
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. In this algorithm, switch “true” and “false”. 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. Nice catch |
||
</emu-alg> | ||
</emu-annex> | ||
|
||
<emu-annex id="sec-html-document-dot-all-exotic-object-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> | ||
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. Consider labeling steps and referring to them by labels, as this is kind of fragile. However, it is how things have worked so far, so no need to fix if you'd rather keep as-is. 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. Step labels sure would be nice, but I'll leave this as-is for now. |
||
<emu-alg start=4> | ||
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. hmm I thought this did something but it doesn't. Guess I'll delete it. |
||
1. If _x_ has an [[isHTMLDDA]] internal slot and _y_ is either *null* or *undefined*, return *true*. | ||
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. HTML document dot all exotic object |
||
1. If _x_ is either *null* or *undefined* and _y_ has an [[isHTMLDDA]] internal slot, return *true*. | ||
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. Same here. |
||
</emu-alg> | ||
</emu-annex> | ||
|
||
<emu-annex id="sec-html-document-dot-all-exotic-object-typeof"> | ||
<h1>Changes to the `typeof` operator</h1> | ||
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.
|
||
<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> | ||
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. xref? I guess we're already in the section due to annex B funtimes, so maybe it doesn't need to be. |
||
<tr> | ||
<td> | ||
Object (has an [[isHTMLDDA]] internal slot) | ||
</td> | ||
<td> | ||
`"undefined"` | ||
</td> | ||
</tr> | ||
</table> | ||
</emu-table> | ||
</emu-annex> | ||
</emu-annex> | ||
</emu-annex> | ||
</emu-annex> | ||
|
||
|
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.
"Document Dot All", or
document.all
? I feel like we may have lost something in the minutes from the TC39 meeting :).Either way is fine, although the latter is slightly less ugly.
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.
HA, maybe! I just assumed it was a deliberately bad editorial choice to underscore the badness of the thing being specified.