Re: [WICG/webcomponents] [idea] Allow HTML Element attributes to accept any type of value, not just strings. (#519)

People above have asked about the html syntax for the feature:

```
<my-custom-element name:  %expr% ;></my-custom-element>
```
the `%expr%` is plain javascript expression, `;` is mandatory.

Given the syntax is new, it can directly change properties, not the attributes. This way users get choice what they specify. 

Considering backward compatibility - we can make `getAttribute()` to also look at properties (but attributes still first), yet always convert to a string type (`setAttribute` gets upgrade to any type, and sets both attribute, with conversion, and property).

Effectively making attributes a stringified versions of properties.

Can be limited to custom elements only


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

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

Received on Tuesday, 3 September 2024 15:39:46 UTC