-
Notifications
You must be signed in to change notification settings - Fork 373
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
::slotted() should full support complex selector!! #745
Comments
You should probably file this issue against https://github.com/w3c/csswg-drafts/. But some reasons:
You can probably use custom properties on the |
::slotted(ul) > li |
Sure, I'm just saying that if it worked, everything would become slower. |
This restriction was intentionally introduced from the beginning. See #331 |
saw that post before. but i don't know.dose that post solved the problem i faced? |
Unfortunately, there is no way. We are unlikely to change the behavior of "::slotted" because we intentionally dropped the support of arbitrary selector for the performance reason. I hope you can find a workaround. |
very dispoint to hear that :( performance or functional, i prefer to first make it functional, then we talk the performance, otherwise, it is just a disability component if there is no directly way, i have to chose
if i use multi times of the component, means i should add that style defination each time, even that style is fixed, and should be placed in a fixed place (just inside the component). it is just a page size waste of the page which use component
there should be a way to support inject content style defination gracefully! @hayatoito |
It is not easy to always make any functional thing performant. |
Thanks. Let me explain a brief history. However, it turned out that supporting arbitrary selector was the cause of performance issue here, we decided to introduce a new pseudo element, "::slotted()", for Shadow DOM v1, where we banned arbitrary selector. We learned and don't want to make it wrong again. |
@TakayoshiKochi @hayatoito |
One solution here is to add the support for selection those 'li' elements directly your shadow tree's slot element using the imperative API: whatwg/html#3534 |
hi @rniwa oh... so it is just a proposal so far... |
There is no such an API right now. The issue 3534 in the HTML repo is where we're discussing this new API. |
Another solution would be you create components instead of using |
i give up my component's universality and chose creating different component |
well i found a indirect solution |
That is absolutely not a solving! Even less mean that the first idea was a good one. We need that! |
@emilio How much slower? Is there data recorded somewhere? It would be very helpful and appreciated if browser authors would show data along with these performance hypotheses, rather than throwing out ideas with no visible and useful performance data. End users have already outlined the use cases. As an example, SVG may not be suitable for first-person shooter graphics, but SVG is certainly useful for other use cases within its performance constraints. In that same light, the usefulness of Web developers should re-running any selectors unnecessarily, for example avoid running them in an animation frame loop over and over (unless that perf hit has no impact on the final outcome). The browser can also cache results for the CSS engine and only invalidate on DOM changes (and users should definitely avoid relying on DOM tree structure changes for animation purposes, but again it really depends on the use case and even the slowest DOM manipulation can be fast enough for many cases). |
#889 (comment) has the implications. The issue is that allowing that affects not the performance of |
i wrote a demo here
for good to SEO,we need support a clear dom structure in html, eg. there is a navbar component,and i add some links inside,and planning to inject them into a navbar component. (even it is not for good to SEO, as a common reuseable component, elements should be inject outside freely)
however when i try to add some style for the < li > tag inside my navbar, it just not work
i found a explanation that slotted is just use simple selector
i wonder why the ::slotted selector can't support the complex selector (or child selector)?
::slotted() should full support complex selector
it just lame if not support
The text was updated successfully, but these errors were encountered: