-
Notifications
You must be signed in to change notification settings - Fork 167
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
Allow constructor<ClassType> as a type accepted by functions. #101
Comments
What does this mean? How would it differ from using Also, I don't think you want |
It would mean that we can share a common algorithm for checking the shape of a class constructor, i.e. a constructor version of https://heycam.github.io/webidl/#es-dictionary for example. At the moment, At the moment we do it with a |
Checking the shape in what sense? What are you really trying to enforce? Note that the checks https://drafts.css-houdini.org/css-paint-api/#dom-paintworkletglobalscope-registerpaint does guarantee absolutely nothing, since what they return can change right after registerPaint returns... |
I should note also that that spec doesn't really define how inputProperties is operated on in sufficient detail, but that's not relevant to this bug. |
If I were to guess what this means it would be doing something like an |
Yeah, good point maybe spec'ing it this way is a bad idea. Basically this spec was copying webcomponents registerElement (now called define?!?!) substantially: Writing the same algorithm N times seemed like overkill. I guess custom elements is different as it explicitly stores the callbacks on define time, then invokes them with the right object? Re: inputProperties, thanks. |
Hmm, I still don't know what you mean by shape. The only thing it checks at this point is IsConstructor. Later, it does a bunch of checks on the return value of the constructor; see https://w3c.github.io/webcomponents/spec/custom/#dfn-create-element 4.1.3-4.1.10. But I don't see a way to enforce that in the type definition. |
Steps 11-18 of define function is checking that the prototype has the
|
Yeah, I wouldn't say it's checking, I would say it's stashing and being sure to throw on invalid values (not undefined, or not a function). And they're not related to the shape (whatever that is) of HTMLElement, since HTMLElement doesn't have any of those methods. |
I think we need to do something here. The current CustomElement and houdini specs are way too JS-y, error prone to maintain and implement. In both cases webidl layer would define what kind of class is expected. (and C++ side of bindings would see that kind of class and could call its methods. If option (2) was used, method call might fail because of the function not being there) |
From personal email, which I never got around to filing here :)
Something like:
The text was updated successfully, but these errors were encountered: