Skip to content

[cssom] Serialized CSS shorthand declaration has incorrect property #12262

Closed as not planned
@Calme1709

Description

@Calme1709

In the steps labeled shorthand loop within serialize a css declaration block, there is a case where we will serialize the declaration with an incorrect shorthand property.

For example declarations: border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; are serialized as border: 1px despite missing the required border-style-* and border-color-* declarations rather than the correct border-width: 1px.

This is because serialize a css value returns a value for the first shorthand property that exactly maps to all current longhands (note step 1), not just shorthand

The fix here would be to either:

  • Check that current longhands can be serialized as shorthand (i.e. shorthand exactly maps to all of the longhand properties in current longhands and shorthand can exactly represent the values of all the properties in current shorthand) before step 7 of shorthand loop.
  • Pass shorthand to serialize a css value and only try to serialize as that shorthand.

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