[ prog / sol / mona ]

prog


What are you working on?

188 2023-04-01 01:06

To remove background images using js rather than a stylesheet, while keeping the rest of the styling, in versions of firefox that do not implement StylePropertyMap:

(removeprops => {
  const clean   = (csd, plist) => plist.forEach (p => csd.removeProperty (p))
  const ondecl  = csd => clean (csd, removeprops)
  const onrules = rlist => Array.from (rlist).forEach (onrule)
  const onrule  = r => {
    if ("style"    in r) { ondecl  (r.style) }
    if ("cssRules" in r) { onrules (r.cssRules) }
  }

  Array.from (document.styleSheets).forEach (sh => onrules (sh.cssRules))
  Array.from (document.querySelectorAll ("[style]")).forEach (e => ondecl (e.style))
}) (["background-image"])
199


VIP:

do not edit these