computed-style-to-inline-style
Version:
Convert a HTML element's computed CSS to inline CSS.
1 lines • 642 B
JavaScript
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.computedStyleToInlineStyle=t():e.computedStyleToInlineStyle=t()}(this,(()=>(()=>{"use strict";var e={};return(()=>{var t=e;Object.defineProperty(t,"__esModule",{value:!0}),t.default=function e(t,o){if(!t)throw new Error("No element specified.");(null==o?void 0:o.recursive)&&Array.prototype.forEach.call(t.children,(t=>{e(t,o)}));const r=getComputedStyle(t);Array.prototype.forEach.call((null==o?void 0:o.properties)||r,(e=>{t.style[e]=r.getPropertyValue(e)}))}})(),e})()));