GoogleChrome / GoogleChrome/lighthouse

SVGs and child nodes referenced from local SVG sprite count towards "Avoid an excessive DOM size"

Open
#6,807 12 comments 6 reactions 0 assignees View on GitHub
needs-investigation P2
Dominant language
JavaScript
Stars
30.8k
Forks
9.8k
Avg merge
1d 20h
Merged PRs (30d)
19

Description

#### Provide the steps to reproduce
1. Run LH on https://andro4all.com/

#### What is the current behavior?
SVGs pointing to a local svg are adding nodes like they were the whole svg.

```html

```

becomes

```html

```

So, lighthouse evaluates this nodes too.

#### What is the expected behavior?
This svgs are pointing to a shared sprite SVG, so, lighthouse doesn't have to add the nodes inside the use tag. This rule penalizes reusing svgs instead of adding a new svg all the time.

Replacing this SVGs for dummy nodes in this page, for instance, like

```html



```

decreases the total by 376 nodes.

#### Environment Information
* Affected Channels: Devtools
* Lighthouse version: Lighthouse 4.0.0-beta
* Node.js version: macOS

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.