karax
karax copied to clipboard
No support for Shadow DOMs
This would be a useful feature for my current project.
Seems like a lot of changes would be required to support it though? For a start setRenderer would need to take an element rather than a string for the root dom and the KaraxInstance would also need to contain the rootElement.
I'm not sure what other changes would also need to be made but hopefully it can be done without breaking backwards compatibility.
You need to elaborate on this feature request. It might be just what I've wanted to do for a couple of weeks now, though... :-)
Well my use case is I want to render a karax vdom within a page inside of a shadow dom root.
Vue lets you do it using the following code
import Vue from 'vue';
const shadow = document.querySelector('#hostElement').shadowRoot;
new Vue({ el: shadow.querySelector('#app'), // ... })
Also seems like shadow dom api needs to be added to the main nim js lib before this is possible.
So... karax.setForeignNodeId()
?
We should revisit this now that https://github.com/nim-lang/Nim/pull/14979 was merged; I also am curious whether shadow dom could simplify some aspects of karax (including encapsulation of DOM and css)
some links:
- https://medium.com/rate-engineering/winning-the-war-of-css-conflicts-through-the-shadow-dom-de6c797b5cba
- https://stackoverflow.com/a/36906251/1426932