Skip to content

ImageElements doesn't include CSS images in pseudo-elements #14350

@brendankenny

Description

@brendankenny

ImageElements loops over all elements in the page looking for computed styles looking for elements with a background-image style, but pseudo-elements can't be accessed via the DOM like that.

As a result, any image in a ::before, ::after, etc isn't included in the artifact and missed in the image audits that rely on it (OptimizedImages does pick up on them because it filters network records on resource/mime types instead, but then an audit like modern-image-formats can't join the results with ImageElements so the details don't include a node for the images)

Example page: https://earthy-picayune-albertonykus.glitch.me/ (lighthouse logo not in ImageElements despite being the only image in the page)

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions