Add [[PlatformBrand]] internal slot to all platform objects #97

Open
annevk opened this Issue Mar 11, 2016 · 4 comments

Comments

Projects
None yet
3 participants
@annevk
Collaborator

annevk commented Mar 11, 2016

The [[PlatformBrand]] internal slot would be a List (in the ECMAScript sense) of strings. One string per interface on the interface chain of the object. So e.g., Text would have "Text, "CharacterData", "Node", "EventTarget".

This would allow us to be more specific what we mean with instances of something and would also clear up a lot of language in IDL I think.

annevk referenced this issue in whatwg/dom Mar 15, 2016

Shadow: add shadow root
This is basically the introduction of ShadowRoot objects as a node in
the DOM Standard. The plan is to port over the features over time,
while trying to make sure the new features and terminology remain
consistent and coherent with the rest of the standard.

I’ll try to prefix ShadowRoot-object-related commits with “Shadow”.
@dominiccooney

This comment has been minimized.

Show comment
Hide comment
@dominiccooney

dominiccooney Sep 1, 2016

Is the [[PlatfromBrand]] on the instance (for example a text node in the DOM, not the Text interface or Text interface prototype object?)

For what it is worth Blink implements the check for HTMLElement in custom elements as if the brand is on the instance; see CustomElementDefinition::checkConstructorResult. Sorry for the C++, but basically it checks the element instance is a HTMLElement; it doesn't consult JavaScript prototypes or anything.

Is the [[PlatfromBrand]] on the instance (for example a text node in the DOM, not the Text interface or Text interface prototype object?)

For what it is worth Blink implements the check for HTMLElement in custom elements as if the brand is on the instance; see CustomElementDefinition::checkConstructorResult. Sorry for the C++, but basically it checks the element instance is a HTMLElement; it doesn't consult JavaScript prototypes or anything.

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Sep 1, 2016

Collaborator

Yes, on the instance. All internal slots are I think.

Collaborator

annevk commented Sep 1, 2016

Yes, on the instance. All internal slots are I think.

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Mar 16, 2017

Collaborator

(Once we add this StructuredSerialize can be simplified a little bit as all platform objects will have this slot and therefore can be treated like promises or WeakMap objects.)

Collaborator

annevk commented Mar 16, 2017

(Once we add this StructuredSerialize can be simplified a little bit as all platform objects will have this slot and therefore can be treated like promises or WeakMap objects.)

@annevk

This comment has been minimized.

Show comment
Hide comment
@annevk

annevk Aug 10, 2017

Collaborator

The other thing that would be useful here is some shorthands around it. When you check against the list of platform brands, there's a difference if the matched value is first in the list or somewhere else (or last and somewhere else, depending on order).

E.g., in DOM we sometimes want to match DocumentFragment, but not ShadowRoot (a subclass).

Collaborator

annevk commented Aug 10, 2017

The other thing that would be useful here is some shorthands around it. When you check against the list of platform brands, there's a difference if the matched value is first in the list or somewhere else (or last and somewhere else, depending on order).

E.g., in DOM we sometimes want to match DocumentFragment, but not ShadowRoot (a subclass).

@annevk annevk referenced this issue in WebAssembly/host-bindings Nov 13, 2017

Open

Instanceof / Upcast equivalent #4

@annevk annevk referenced this issue in w3c/webcomponents Feb 18, 2018

Closed

Interface/class-based selector #719

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment