CSS element()

Open
#1,451 2 comments 24 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
css

Research direction

Start by examining the existing CSS Images WPT source at https://github.com/web-platform-tests/wpt/tree/master/css/css-images to see if any element() tests already exist. Then, create a new directory css/css-images/element/ as suggested. The investigation involves reading the CSS Images Level 4 spec for the element() notation and designing tests for simple sources, live updates, and reference loops. 'Done' means a small, reviewed test suite is ready for browser teams.

Written by the indexing model from the issue text.

Description

investigation-effort-proposal
Description

I propose an investigation of CSS element() which lets a page use the appearance of one element as an image elsewhere on the same page. The first target would be backgrounds that follow changes to their source, such as a small page preview or a canvas used in several places.

The investigation would establish a useful, clearly specified subset and build tests that browser teams can share. It would cover simple sources, live updates, image size, missing references, and reference loops.

Specification and existing tests

The current directory listing has no dedicated element/ suite. The first task would include checking for relevant tests elsewhere before adding new ones.

Rationale

Reasons for including the feature

There are concrete examples of developers using this kind of visual reuse:

  • A page minimap. The earlier proposal discussion reports its use on Stefan Judis's site.
  • Canvas output used as CSS images. The CSS Paint polyfill README documents using -moz-element() and -webkit-canvas() in some browsers, with canvas encoding through toDataURL() or toBlob() in others. That is a concrete example of a library needing different paths for similar work.
  • Developer interest. Comments on the earlier proposal express interest in the feature. This is useful qualitative evidence, but it is not a representative survey or a usage estimate.
  • A known test gap. The 2024 rejection identifies an actionable obstacle. An investigation can address that obstacle with a small, reviewed suite instead of repeating a broad implementation request.
Dominant language
JavaScript
Stars
591
Forks
39
Avg merge
3h 8m
Merged PRs (30d)
2

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from web-platform-tests/interop

All issues in web-platform-tests/interop

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.