PluginProbe
Extendify / 3.1.6
Extendify v3.1.6
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
extendify / src / Agent / lib / computed-styles.js

computed-styles.js in Extendify 3.1.6, at src/Agent/lib/computed-styles.js

36 lines 861 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 // The baseline for relative requests — attributes alone make an unstyled h1 look
2 // size-less, so "larger" snaps below the theme default.
3 const ALLOWLIST = [
4 'fontSize',
5 'lineHeight',
6 'fontWeight',
7 'fontFamily',
8 'fontStyle',
9 'letterSpacing',
10 'textTransform',
11 'textDecoration',
12 'color',
13 'backgroundColor',
14 'borderRadius',
15 'borderWidth',
16 'borderStyle',
17 'borderColor',
18 'boxShadow',
19 'padding',
20 'margin',
21 ];
22
23 const isEmptyValue = (value) =>
24 !value || value === 'normal' || value === 'none' || value === 'auto';
25
26 export const readComputedStyles = (el) => {
27 if (!el?.ownerDocument?.defaultView) return null;
28 const cs = el.ownerDocument.defaultView.getComputedStyle(el);
29 const out = {};
30 for (const prop of ALLOWLIST) {
31 const value = cs[prop];
32 if (!isEmptyValue(value)) out[prop] = value;
33 }
34 return Object.keys(out).length ? out : null;
35 };
36