Rest
...elements: Element[]The elements at the top of all trees to process
import { popStyles } from 'deleight/css'
const markup =
`<div>
<style>${css}</style>
<div>
<link rel="stylesheet" href="page.css">
</div>
<style>${css}</style>
<div><div><link rel="stylesheet" href="page.css"></div></div>
</div>`;
const tree = document.createElement('div');
const styles = [...popStyles(tree)];
// styles the contains: [CSSStyleSheet, Promise<CSSStyleSheet>,
CSSStyleSheet, Promise<CSSStyleSheet>]
Extracts and removes normal stylesheets from the trees of the given elements.
style
orlink
elements with 'ski-p' attributes, will be ignored in the processing. Also those withkee-p
attributes will be processed but they will not be removed from the tree.Use the exported popAttrs object to configure the attribute names for
skip
andkeep
if the afore-mentioned defaults will not suffice for your use case.