Re: [csswg-drafts] [css-logical] Flow-relative syntax for `margin`-like shorthands (#1282)

> If you write, you can set the bang in `.setProperty()`

How would this work? Would there be a 4th argument?

```js
element.style.setProperty("margin", "1px 2px 3px 4px"); // non-important, physical
element.style.setProperty("margin", "1px 2px 3px 4px", "important"); // important, physical
element.style.setProperty("margin", "1px 2px 3px 4px", "", "logical"); // non-important, logical
element.style.setProperty("margin", "1px 2px 3px 4px", "important", "logical"); // important, logical
```
Or conflate all flags into the 3rd argument like `""`, `"logical"`, `"important"`, `"logical important"`?

What about reading? I bet most scripts will just use `getPropertyValue("margin")` without checking `getPropertyMappingLogic("margin")` or whatever. So things may start breaking, causing authors to avoid setting properties logically, making this feature pointless.

What about computed styles? I don't think we want to track if the value comes from a logical or physical declaration, just like we don't track the priority (computed properties are considered non-important). So should they be considered physical or logical?

From the point of view of CSSOM, using different properties seems way less problematic.


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


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

Received on Saturday, 17 September 2022 16:57:44 UTC