Re: [csswg-drafts] [css-shadow-parts] consider moving part-mapping to style rules

> what's the point of doing this in CSS?

I wrote my case above. Not having the ability to define the parts in CSS, means that my users will have to maintain a more complicated source, or compromise on custom run-time code in order to support web components.

> we'd still have to keep matching those IDs & classes to find out if any given element defines a part or not.

I agree, this is another level of abstraction between CSS an DOM.

> Here's another problem. If we did this in CSS, I bet my money on someone coming around and asking for a DOM event whenever the presence of a part changes (i.e. appears / disappears).

I don't know the implementation internals that you are, obviously, aware of, but I think that there are lots of use cases where allowing the developer to hook into changes in the CSS with JavaScript will improve the way we build web applications today. 

also:
 - Wouldn't such a request might already be raised for components wanting to know when a composed component changed it's parts?
 - Isn't this already the case with `animationstart` and `transitionstart `? 

-----

That being said, I accept that you have more knowledge of the implementation risks. And if this is an implementation / performance issue, then it's beyond my current understanding. However, API-wise, I still think having the parts definitions as part of the style, which is also the context in which a developer targets these parts, is better.

-- 
GitHub Notification of comment by idoros
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/2904#issuecomment-410507511 using your GitHub account

Received on Sunday, 5 August 2018 09:30:48 UTC