webcomponents / webcomponents/polyfills

[ShadyCSS] Expose prepareTemplate for non template DocumentFragments

Open
#26 4 comments 0 reactions 0 assignees View on GitHub
Package: shadycss Severity: Medium Type: Feature wontfix
Dominant language
HTML
Stars
1.2k
Forks
168
PR merge metrics
No merged PRs in 30d

Description

As briefly suggested at [README.md#usage](https://github.com/webcomponents/shadycss#usage), to support VanillaJS elements I need to use ShadyCSS API manually.

> 1. First, call `ShadyCSS.prepareTemplate(template, name)` on a `` element that will be imported into a `shadowRoot`

The problem is, I usually don't use a `` to create `shadowRoot` (see https://github.com/webcomponents/shadycss/issues/144). Creating `HTMLTemplateElement` for every single string or `DocumentFragment` I want to put into my Shadow, seems like an overhead.

Could `ShadyCSS` expose a method to process `DocumentFragment` or string? Like `StyleTransformer` ;)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.