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

Update all constructors, including [HTMLConstructor] #4915

Merged
merged 2 commits into from
Sep 24, 2019

Conversation

domenic
Copy link
Member

@domenic domenic commented Sep 17, 2019

This updates all the constructors in the standard for recent changes to
Web IDL. In particular:

  • Replace [Constructor] extended attributes with constructor operations
  • Cross-links constructor operations on events to the DOM event
    constructor definition
  • Changes [HTMLConstructor] to apply to constructor operations, instead
    of to interfaces, and updates all usages of it
  • Changes the definition of [HTMLConstructor] to leverage new Web IDL
    concepts of "usual constructor steps" and "internally create a new
    object implementing the interface"

Fixes #4870. Fixes #4890.


Reviewers: feel free to skim the [Constructor] -> constructor() changes, but please do check the new definition of [HTMLConstructor]. The intention was not to introduce any normative changes, but in the course of making it more rigorous, something might have slipped in.

Marking "do not merge yet" as this has a dependency on Web IDL introducing the term "usual constructor steps" so that we can override them. I will work on that PR next.


/canvas.html ( diff )
/comms.html ( diff )
/dom.html ( diff )
/edits.html ( diff )
/embedded-content.html ( diff )
/form-elements.html ( diff )
/forms.html ( diff )
/grouping-content.html ( diff )
/iframe-embed-object.html ( diff )
/image-maps.html ( diff )
/infrastructure.html ( diff )
/input.html ( diff )
/interactive-elements.html ( diff )
/media.html ( diff )
/obsolete.html ( diff )
/scripting.html ( diff )
/sections.html ( diff )
/semantics.html ( diff )
/server-sent-events.html ( diff )
/tables.html ( diff )
/text-level-semantics.html ( diff )
/web-messaging.html ( diff )
/web-sockets.html ( diff )
/webappapis.html ( diff )
/workers.html ( diff )

This updates all the constructors in the standard for recent changes to
Web IDL. In particular:

* Replace [Constructor] extended attributes with constructor operations
* Cross-links constructor operations on events to the DOM event
  constructor definition
* Changes [HTMLConstructor] to apply to constructor operations, instead
  of to interfaces, and updates all usages of it
* Changes the definition of [HTMLConstructor] to leverage new Web IDL
  concepts of "usual constructor steps" and "internally create a new
  object implementing the interface"

Fixes #4870. Fixes #4890.
@domenic domenic added do not merge yet Pull request must not be merged per rationale in comment topic: custom elements Relates to custom elements (as defined in DOM and HTML) labels Sep 17, 2019
domenic added a commit to whatwg/webidl that referenced this pull request Sep 17, 2019
This is for use in [HTMLConstructor] in whatwg/html#4915.
@domenic
Copy link
Member Author

domenic commented Sep 17, 2019

Direct link to preview of the new [HTMLConstructor] definition: https://whatpr.org/html/4915/dom.html#html-element-constructors

corresponding JavaScript function object. When invoked with [[Call]], the NewTarget value is
undefined, and so the algorithm below will immediately throw. When invoked with [[Construct]], the
[[Construct]] <var>newTarget</var> parameter provides the NewTarget value.</p>
<p><span data-x="interface object">Interface objects</span> declared with constructor operations
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interface objects aren't declared with a constructor operations; interfaces might be.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Interface objects for interfaces declared with ..."?

Copy link
Contributor

@bzbarsky bzbarsky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thank you! I agree that this does not change observable behavior, as far as I can tell.

corresponding JavaScript function object. When invoked with [[Call]], the NewTarget value is
undefined, and so the algorithm below will immediately throw. When invoked with [[Construct]], the
[[Construct]] <var>newTarget</var> parameter provides the NewTarget value.</p>
<p><span data-x="interface object">Interface objects</span> declared with constructor operations
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "Interface objects for interfaces declared with ..."?

data-x="concept-custom-element-definition-local-name">local name</span>, and <span>node
document</span> set to the <span>current global object</span>'s <span
data-x="concept-document-window">associated <code>Document</code></span>.</p></li>
<li><p>Let <var>element</var> be the result of <span data-x="internally create a new object
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to say something here about rethrowing exceptions? It's not clear to me when we do that explicitly and when it's sort of implied...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These days it's implied. (Unless we're explicitly in ?/! mode, which we're not here.)

domenic added a commit to whatwg/webidl that referenced this pull request Sep 24, 2019
This is for use in [HTMLConstructor] in whatwg/html#4915.
@domenic domenic removed the do not merge yet Pull request must not be merged per rationale in comment label Sep 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: custom elements Relates to custom elements (as defined in DOM and HTML)
3 participants