Open lublak opened 1 month ago
I think to support shadow dom, we need an option for "document". There is a lot of "document". For usage in a shadow it sould be the current shadowroot.
// default:
new Tagify(
/* ...., */
{
root: document
}
)
new Tagify(
/* ...., */
{
root: this.shadowRoot
}
)
what do you need shadowdom
for?
@yairEO I mostly use web components to develop internal applications. To use tagify In a custom web component. It should not depend on document.body. (it doesn't work with document.body.contains).
Can/will you make a pull-request?
Prerequisites
💥 Demo Page
I can do it in some days, i need some time to build a simple lit element for this.
Explanation
There are a lot of document.body checks in the code which doesn't work in shadowdom. It should be the appendTarget element:
https://github.com/yairEO/tagify/blob/master/src/parts/dropdown.js#L155 https://github.com/yairEO/tagify/blob/master/src/parts/dropdown.js#L218
Checking in the document.body instead of appendTarget
A lot of glitches.