Lit-element: Pseudo elements like ::part and ::theme

Created on 8 Jul 2019  路  2Comments  路  Source: Polymer/lit-element

Hi, is there a chance that the pseudo elements ::part and ::theme work in all browser?

It works for Chrome and opera but not in Firefox or Edge.

Thank you

Medium Enhancement

Most helpful comment

There is a branch with some experimental work here that we did awhile back. We're not super happy with the performance impact of this approach and we're not sure right now if/when/how we're going to carry this forward.

One thing we think definitely makes sense and can be implemented with minimal performance impact is to use part attributes in an element's DOM and then have a system that can inject stylesheets into elements that target (only) these parts. This approach is not strictly a polyfill for ::part but it is inspired by and compatible with it and gives some of the same functionality. There's an example in that same branch here. Hope that helps.

All 2 comments

There is a branch with some experimental work here that we did awhile back. We're not super happy with the performance impact of this approach and we're not sure right now if/when/how we're going to carry this forward.

One thing we think definitely makes sense and can be implemented with minimal performance impact is to use part attributes in an element's DOM and then have a system that can inject stylesheets into elements that target (only) these parts. This approach is not strictly a polyfill for ::part but it is inspired by and compatible with it and gives some of the same functionality. There's an example in that same branch here. Hope that helps.

Was this page helpful?
0 / 5 - 0 ratings