Re: [css-houdini-drafts] [css-paint-api] Running author function without proper preparation.

> Using a callback interface would mean each time we need to access the paint or animate function off the instance, instead what we do here is look up the paint method upon registration, and then invoke that each time.

To me, these two things don't make much difference.  I can tell the differences, but do we really want the differences?  I.e. own properties on the object are ignored, the property look-up is performed only once when it gets registered, etc.  I don't understand what's good if we ignore own properties.  Reducing the property look-up would be performance-win, but is it important?  For typical use cases, there shouldn't be a behavioral difference.  Maybe I'm missing something.

> This was done to be consistent with custom elements which uses the exact same semantics.

I read [Element definition](https://html.spec.whatwg.org/multipage/custom-elements.html#element-definition), and have the same question.  Why do we need to make (minor IMHO) differences here?  Maybe I should learn something here.

> callback function = JS function + callback context. Callback context is important for computing the incumbent realm, indeed.

Yes.  And it's important *when* it's converted, because the incumbent realm changes by time.

> If we use this pattern in more places, isn't that indication we should start abstracting it?

I first thought that "custom elements" has unique requirements, that I don't know yet, due to its nature, and only custom elements needs a special way of registration.  I'm not sure if CSS Painting API has the same requirements or not.  If not, maybe CSS Painting API should be defined in a different way?

If many things have the same requirements and this pattern should be used widely, then I'm happy with this pattern abstracted/defined in Web IDL.


-- 
GitHub Notification of comment by yuki3
Please view or discuss this issue at https://github.com/w3c/css-houdini-drafts/issues/743#issuecomment-379646250 using your GitHub account

Received on Monday, 9 April 2018 06:22:01 UTC