- From: Peter Burns <notifications@github.com>
- Date: Tue, 01 Aug 2023 16:39:43 -0700
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <WICG/webcomponents/pull/1023/review/1557974904@github.com>
@rictic commented on this pull request.
> +
+Allowing `{{}}` inside an attribute works the same as a
+[partial attribute update](./DOM-Parts-Imperative.md#partial-attribute-updates),
+in that it will create an `AttributePart` for the entire attribute, but it will
+have multi-valued `value` property.
+
+```html
+<template>
+ <section>
+ <h1 id="name">{{}}</h1>
+ Email: <a id="link" href="mailto:{{}}">{{}}</a>
+ </section>
+</template>
+```
+
+The `AttributePart` for `href` would have `value` equal to `['mailto:', '']`.
Two motivating examples:
```html
<div class="foo {{color}} bar"></div>
<iframe src="https://partner.example.com/page?{{params}}">
```
In these cases, I think a user would expect that after updating these AttributePart's values, foo and bar would still be classes on the div, and the iframe would only load from the partner page.
If a library on top of template parts wants to update the attribute to a value that doesn't include the static strings (e.g. via a user level directive system, or when set to a magic value defined by the library), it could still do so by getting the element and attribute name off the part and calling imperative APIs.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/pull/1023#discussion_r1281245087
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/pull/1023/review/1557974904@github.com>
Received on Tuesday, 1 August 2023 23:39:48 UTC