-
Notifications
You must be signed in to change notification settings - Fork 174
Define "usual constructor steps" #797
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
Changes from all commits
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 |
---|---|---|
|
@@ -11126,13 +11126,25 @@ and is described in more detail in [[#interface-prototype-object]]. | |
Note: Since an [=interface object=] is a [=function object=] | ||
the <code>typeof</code> operator will return "function" when applied to an interface object. | ||
|
||
An interface may have <dfn export>overridden constructor steps</dfn>, which can | ||
change the behavior of the [=interface object=] when called or constructed. By | ||
default interfaces do not have such steps. | ||
|
||
<p class="advisement"> | ||
In general, constructors are described by defining a [=constructor operation=] and its behavior. | ||
The [=overridden constructor steps=] are used only for more complicated situations. | ||
Editors who wish to use this feature are strongly advised to discuss this by | ||
<a href="https://github.com/heycam/webidl/issues/new?title=Intent%20to%20use%20constructor%20steps">filing an issue</a> before proceeding. | ||
</p> | ||
|
||
<div algorithm> | ||
|
||
The [=interface object=] for a given [=interface=] |I| | ||
with [=identifier=] |id| and in [=Realm=] |realm| | ||
is <dfn lt="create an interface object">created</dfn> as follows: | ||
|
||
1. Let |steps| be the following steps: | ||
1. Let |steps| be |I|'s [=overriden constructor steps=] if they exist, or | ||
the following steps otherwise: | ||
1. If |I| was not declared with a [=constructor operation=], | ||
then [=ECMAScript/throw=] a {{ECMAScript/TypeError}}. | ||
1. If {{NewTarget}} is <emu-val>undefined</emu-val>, then | ||
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. Should we keep the first two steps, even when overriding the rest of the algorithm? Maybe also the last four steps? 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 guess that would work for [HTMLConstructor], although it feels cleaner to just have a general primitive that replaces the whole thing. 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'll keep it like this for now, but we can refactor later if you think it's much better. |
||
|
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.
Maybe add a warning like we have a few already for legacy features, saying something like