Open caridy opened 6 years ago
Why?
how to use d3 inside LWC?
All DOM APIs should work no?
We have some restrictions in place, and we were planning to add more:
Revamping this since we are having some issues with retargeting, e.g. : https://github.com/salesforce/lwc/pull/739
Well the portal usecase is specially important for CSS since we are workarounding the retargeting for now.
The concept is not really about a portal, but about manipulation of dom elements inside the template via imperative API. We have implemented a new directive:
<template>
<div lwc:dom="manual"></div>
</template>
where only leaf nodes can have that directive in the template, and only those elements could be manipulated by appending or removing children to them. Those new elements inserted there will be adopted by the shadow, which means they will behave just like anything else from the actual template.
Notes:
Let's keep this open until after we make the current warning a hard error.
maybe solved by https://github.com/salesforce/lwc/pull/1193?
@ekashida can you confirm that his is now done?
@caridy From what I can tell, this issue is to track the lwc:dom="manual"
feature, which has already been implemented. I think you commented above that we should keep this issue open until we convert all the error logging into actual exceptions.
Sometimes, components need to insert d3 and other markup that can't be produced by describing it in the template. In this case, we should allow templates to signal that the entire template, or at least an element in the template is supposed to be a portal to show 3rd party content.