Re: [WICG/webcomponents] Proposal: Custom attributes for all elements, enhancements for more complex use cases (Issue #1029)

> Anyway, do you see any reason Typescript/JSX couldn't be trained to support autocomplete / compiling support for something like:
> 
> ```js
> <table>
>   <tr [behaviorForTheTr 
>            myFirstProp:={myListItem} 
>            mySecondProp:={isCollapsed} 
>            my-first-attribute?={isOdd}] >
>     <td></td>
>   </tr>
> </table>
> ```

I think it is unlikely for JSX to go in that direction. But with that said, it seems from your snippet, that the attributes inside the brackets are for the behavior right? In that case, maybe this is better:

```html
<table>
  <tr>
    <behavior-For-The-Tr myFirstProp="..." mySecondProp="..." my-first-attribute="..."></behavior-For-The-Tr>
    <td></td>
  </tr>
</table>
```

(that's HTML, but interpolation would work in JSX, `html` template tag, etc, or hopefully with Declarative Custom Elements which may include both attribute and prop definitions). That's assuming we could fix the parsing issue. Is that possible? If so, then that custom element can do whatever it wants with its `.parentElement`, while also having a separate bag of attributes (type checkable in today's tooling) and `display: none` because it is a "behavior" only.

### So that's another question for some use cases: can we fix parsing? Or is that impossible?

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

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

Received on Wednesday, 15 May 2024 04:23:40 UTC