w3c / w3c/csswg-drafts

[cssom] Shortest serialization principle with multiple minimal possibilities

Open
#8,155 11 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Agenda+ cssom-1
Dominant language
Bikeshed
Stars
4.9k
Forks
816
PR merge metrics
PR metrics pending

Description

https://drafts.csswg.org/cssom/#serialize-a-css-value

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

But there are 2 different minimal ways to represent list-style: outside none disc:

  • list-style: outside
  • list-style: disc

And there are 3 different minimal ways to represent border: medium none currentcolor:

  • border: medium
  • border: none
  • border: currentcolor

And there are 4 different minimal ways to represent text-decoration: none solid currentcolor auto:

  • text-decoration: none
  • text-decoration: solid
  • text-decoration: currentcolor
  • text-decoration: auto

And so on with lots of shorthands. Which minimal serialization should be picked?

var {style} = document.createElement("div");
style.listStyle = "outside none disc";
style.listStyle; // Firefox: "outside". Blink/WebKit: "outside none disc"
style.border = "medium none currentcolor";
style.border; // Firefox: "medium none". Blink/WebKit: "medium none currentcolor"
style.textDecoration = "none solid currentcolor auto";
style.textDecoration; // Firefox: "none". Blink: "none solid currentcolor". WebKit: "" (CSS3 syntax not implemented)

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 CSSOM “serialize a CSS value” section linked in the issue and compare its shortest-serialization rule with the listed list-style, border, and text-decoration examples. The work is done when the specification clearly defines which serialization to choose when multiple minimal representations have the same meaning.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
web-dev
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Active
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.