Re: [csswg-drafts] [cssom] Serialization of a declaration block not idempotent in presence of logical properties. (#3244)

> Basically, being between some longhands that match a certain condition is equivalent to being between the first and the last longhands that match the condition.

In my example, the declaration for `border-block-start-width` is between the first and last declaration of `current declarations`, but it is not between declarations whose longhands are in the same logical property group. There should be three declarations whose longhands are in the same logical property group: the declaration not in `current longhands`, and the "wrapping" declarations in `current longhands`.

To make it clear:

```js
style.borderTopWidth = '1px'
style.borderBlockStartWidth = '2px'
// Some border-*-width is missing here 
// so that the longhand of the above declaration 
// is in between two longhands whose longhands 
// are in the same logical property group
style.borderTopStyle = 'solid'
style.borderTopColor = 'green'
style.cssText; // border-top: 1px solid green; border-block-start-width: 2px;
```

```js
style.borderTopWidth = '1px'
style.borderBlockStartWidth = '2px'
style.borderRightWidth = '1px'
style.borderBottomWidth = '1px'
style.borderLeftWidth = '1px'
style.cssText; // border-top-width: 1px; border-block-start-width: 2px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px;
```

Note that Firefox serializes `style.cssText` to `border-top-width: 1px; border-block-start-width: 2px; border-top-style: solid; border-top-color: green;` in the first example. It may be right because the order of declarations would be preserved with a round-trip. I do not know if this should be a requirement for shorthand serialization.

I agree with your rewording. I also considered splitting the sentence (step) by listing conditions but ended up only rewording it to make my point. I was also not comfortable with *a declaration in between longhands in `current longhands`* because a declaration is compared to longhands, and `current longhands` contains declarations, not longhands.

But I am sure someone can come up with the ideal and correct wording.

-- 
GitHub Notification of comment by cdoublev
Please view or discuss this issue at https://github.com/w3c/csswg-drafts/issues/3244#issuecomment-1288938715 using your GitHub account


-- 
Sent via github-notify-ml as configured in https://github.com/w3c/github-notify-ml-config

Received on Monday, 24 October 2022 12:09:44 UTC