Re: [csswg-drafts] [css-logical-1] [css-cascade-3] The all longhand probably shouldn't set logical properties.

> this is then serialized to the style attribute in a predefined order (the order you set the properties in doesn't matter)

The order does matter. That's because [set a CSS declaration value](https://drafts.csswg.org/cssom/#set-a-css-declaration-value) uses a "list of declarations", and lists are ordered. The algorithm also says "append", which implies there is an order. (Firefox and Chrome are compliant, but it seems Edge does not respect this insertion order).

The problem is that the algorithm only appends the new declaration if there was no previous declaration of the same property. Otherwise, it only updates the value of the old one, without moving it to the end.

Therefore, if you first set properties using `all` and then set a property to another value, you don't know whether the new value will win the cascade or not, because the order in which `all` inserted declarations into the list does not seem to be defined anywhere.

Additionally, the resulting declarations of the following steps will be

```js
elem.style.marginTop = "1px";        // { margin-top: 1px }
elem.style.marginBlockStart = "2px"; // { margin-top: 1px; margin-block-start: 2px }
elem.style.marginTop = "0px";        // { margin-top: 0px; margin-block-start: 2px }
```
so (assuming `writing-mode: horizontal-tb`) the top margin will end up being `2px` instead of `0px`. Instead, I think it should be


```js
elem.style.marginTop = "1px";        // { margin-top: 1px }
elem.style.marginBlockStart = "2px"; // { margin-top: 1px; margin-block-start: 2px }
elem.style.marginTop = "0px";        // { margin-block-start: 2px; margin-top: 0px }
```

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

Received on Friday, 27 October 2017 19:37:26 UTC