DEV Community

Discussion on: 〈load-file〉Web Component, add external content to the DOM

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️

Pretty cool, I like it :D

However, you forgot to mention SVG can be loaded with <object>, which allows some more of the CSS inside the SVG to do its magic, outside style rules still don't apply, but if I remember correctly, outside custom properties are available inside the SVG.

Collapse
 
dannyengelman profile image
Danny Engelman • Edited

Tnx,

I added object and a link to vecta.io/blog/best-way-to-embed-svg which describes all in detail

Also changed functionality slightly. Only the first <style> element will now be moved to shadowDOM. That way any <slot> element in a loaded .html file will slot content from lightDOM correctly