[WICG/webcomponents] [dom-parts] Attribute Grouping (Issue #1011)

There is an open question as to how to multiple (partial) attribute parts can work together to set the value.

Current proposal

### Option 1.
In this approach, `AttributePart` gets a new static function which creates a list of AttributeParts which work together to set a value when the values are to be committed:
```
const [firstName, lastName] = AttributePart.create(element, 'title', null, [null, ' ', null]);
// Syntax to be improved. Here, a new AttributePart is created between each string.
```

### Option 2.
In this approach, we group multiple AttributeParts together by creating an explicit group:
```
const firstName = new AttributePart();
const lastName = new AttributePart();
const group = AttributePartGroup(element, 'title');
group.append(firstName, ' ', lastName);
```

### Option 3.
Unlike option 2, this creates `PartialAttributeParts` from `AttributePart`, meaning that `AttributePart` in option 3 plays the role of `AttributePartGroup` in option 2:
```
const firstNamePartial = new PartialAttributePart();
const lastNamePartial = new PartialAttributePart();
const part = AttributePart(element, 'title');
part.values = [firstNamePartial, ' ', lastNamePartial];
```

-- 
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/1011
You are receiving this because you are subscribed to this thread.

Message ID: <WICG/webcomponents/issues/1011@github.com>

Received on Tuesday, 2 May 2023 17:07:37 UTC