Skip to content

[cssom] Shortest serialization principle with multiple minimal possibilities #8155

@Loirooriol

Description

@Loirooriol

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions