- From: 狒狒神 <notifications@github.com>
- Date: Mon, 20 Dec 2021 09:26:42 -0800
- To: WICG/webcomponents <webcomponents@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Monday, 20 December 2021 17:26:55 UTC
Should we have a new method for it, which won't break current system. Just like `setProperty`/`getProperty`. First of all, it is different from the node's own properties, such as `inputNode.value`. Its purpose is to help developers pass data to *custom element*.
Why not set property directly through `node.a = 1`:
- Avoid conflict with node's own properties
- Better performance for corresponding life cycle, e.g. `propertyChangedCallback`, which will simplify `setter/getter`
It should follow the following rules:
- Able to pass non-string data
- Able to reflect properties to attributes
For high performance, might we can allow *custom element* developer declare the type
of `properties` in advance , such as:
```js
// Just like Polymer
class MyCustomElement extends HTMLElement {
properties: {
name: {
type: 'boolean',
defaultValue: true
}
}
}
```
The above is just my simple idea.
--
Reply to this email directly or view it on GitHub:
https://github.com/WICG/webcomponents/issues/519#issuecomment-998128837
You are receiving this because you are subscribed to this thread.
Message ID: <WICG/webcomponents/issues/519/998128837@github.com>
Received on Monday, 20 December 2021 17:26:55 UTC