Re: [csswg-drafts] Idea: Multiple Values for a Property (#9490)

### Syntax Possibilities

Perhaps `&value` would be better than `+value` because `+` might be used for numeric values, e.g., `+123`.

```css
div { prop: &x }
#el { prop: &y  }
.cls { prop: &z }
```

### Interoperation between Single-value and Set-like Semantics

How might this set-like functionality interoperate with traditional single-value semantics?

Brainstorming, sorting the declarations using the current techniques, [cascade](https://developer.mozilla.org/en-US/docs/Web/CSS/Cascade) and [specificity](https://developer.mozilla.org/en-US/docs/Web/CSS/Specificity), one could interpret ordinary declarations as invoking an `assignValue()` method and set-based declarations as invoking an `addValue()` method. In theory, if the declarations were processed in order, single-value and set-based semantics could co-exist in a system.

### Object Model

With respect to how to go about adding this functionality to CSS, we might look at and consider the CSSOM, specifically [CSSStyleDeclaration](https://drafts.csswg.org/cssom/#cssstyledeclaration) which provides the [getPropertyValue()](https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertyvalue) method which returns a [`CSSOMString`](https://webidl.spec.whatwg.org/#idl-DOMString) value rather than an [`object`](https://webidl.spec.whatwg.org/#idl-object) (an `object` could be either a string or an array or list of strings). Perhaps a string representation of a set-based property's value returned by `getPropertyValue()` could be a delimited string of elements? Perhaps there could also be a `getPropertyValues()` function which would return an array or list of string-based values, this array or list having one element in it for single-value scenarios?

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


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

Received on Wednesday, 18 October 2023 10:22:33 UTC