(node)
| 393 | } |
| 394 | } |
| 395 | function getBg(node) { |
| 396 | if ( |
| 397 | !node || |
| 398 | node.nodeName?.toUpperCase?.() == "HTML" || |
| 399 | node.nodeName == "#document" |
| 400 | ) { |
| 401 | return false; |
| 402 | } |
| 403 | return ["", "::before", "::after"] |
| 404 | .map((s) => { |
| 405 | let nodeStyle = window.getComputedStyle(node, s); |
| 406 | let bg = nodeStyle.backgroundImage; |
| 407 | if (bg) { |
| 408 | let bgUrls = bg.split(","); |
| 409 | let urls = bgUrls.map((url) => url.match(/url\((['"]?)(.*?)\1\)/)?.[2]); |
| 410 | return urls.filter((url) => url !== null); |
| 411 | } |
| 412 | return null; |
| 413 | }) |
| 414 | .flat() |
| 415 | .filter((_) => _); |
| 416 | } |
| 417 | const lazyImgAttr = [ |
| 418 | "src", |
| 419 | "_src", |
no test coverage detected