Giter Site home page Giter Site logo

Comments (6)

dominiccooney avatar dominiccooney commented on May 27, 2024

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.

from webidl.

annevk avatar annevk commented on May 27, 2024

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

from webidl.

annevk avatar annevk commented on May 27, 2024

(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.)

from webidl.

annevk avatar annevk commented on May 27, 2024

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).

from webidl.

littledan avatar littledan commented on May 27, 2024

It sounds like we'd have two "entrypoints" to [[PlatformBrand]]:

  • In WebIDL, when evaluating the phrase, "is a platform object that implements"
  • In all the other specs, when they use the phrase, "a new XYZ object"

Is that what you were picturing, @annevk? The first one will be pretty easy to update, but the second would be a lot of work to go around fixing up. Would it be reasonable to add a "create a new platform object of interface |interface|" algorithm to WebIDL and update all the other specs to call into that?

from webidl.

annevk avatar annevk commented on May 27, 2024

Yeah, I think that's reasonable. We also want "x is a XYZ" formalized as a shorthand for "is a platform object that implements" for use in other standards.

I'm not a 100% sure

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

is true anymore btw. I kinda hope it's not.

from webidl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.