w3c / w3c/csswg-drafts

[css-backgrounds] Always serialize 'background-size' and `mask-size` as two values

Open
#7,802 15 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Closed Accepted by CSSWG Resolution css-backgrounds-3 cssom-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

See https://github.com/whatwg/compat/issues/28

That change is now implemented in WebKit: https://github.com/WebKit/WebKit/pull/3372

Relevant CSS specs: https://drafts.csswg.org/css-backgrounds-3/#background-size and https://drafts.csswg.org/cssom/#serialize-a-css-value

@pxlcoder asked

Do we have consensus from other engines on:

Always serialize background-size as two values.

CSSOM says

  • If component values can be omitted or replaced with a shorter representation without changing the meaning of the value, omit/replace them.

  • If either of the above syntactic translations would be less backwards-compatible, do not perform them.

The last bullet point seems to apply here, as it impacts -webkit-background-size if implemented as a legacy shorthand. But maybe we can include each known property with special serialization, and what that serialization should be, so it's not ambiguous for those properties.

@pxlcoder also asked:

Should we also change the serialization of mask-size to always use two values, for consistency?

Since mask-size also has a -webkit- prefixed variant and also uses <bg-size># value grammar, I think it makes sense to use the same serialization rule as for background-size.

Contributor guide

Open the contributing guide

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.

Research direction

Start with the CSS Backgrounds and CSSOM serialization sections linked in the issue, then review the WHATWG compatibility discussion and WebKit change. Determine the agreed serialization rules for background-size and mask-size, including their prefixed variants, and document the consensus in the relevant specification text.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
documentation, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.