Re: [w3c/webcomponents] idea: easy way to specify attributes (and optionally enable getters/setters). (#517)

@rniwa 

> That's just not how HTML works. When you create a HTML element, it doesn't have any attributes until a parser, DOM API, etc.. adds one.

I know, which is why I've made the overall suggestion of this issue. I've mentioned above that

> In general, any framework or platform (in this case Chrome, Firefox, Edge, Safari) should aim for not using serialization/deserialization until the very last moment, or not at all. Nothing should need to be serialized until necessary (f.e. DevTools may need to show the values in the element inspector, but if DevTools are never used, serialization/deserialization may never even need to happen). Serialization/deserialization should only need to happen when some data needs to be displayed as text unless the data is text, or when saving/loading state from somewhere like a backend database. Serialization/deserialization would be great for server-side rendering, but should be completely avoided until the last minute when it is needed. The average web UI today doesn't not need serialization/deserialization except for when reading from HTML directly (i.e. the initial parsing of HTML coming from a server, using innerHTML, etc), but when the imperative DOM API is being used, serialization/de
 serialization is completely unnecessary.

Currently, the DOM APi expects everything to be serialized/deserialized 100% of the time. What I'm suggesting is that serialization/deserialization does not need to happen 100% of the time, and in many cases it can be entirely avoided depending on the needs of the application.

For example, I imagine I'll want to serialize things when saving to a server, and would want to deserialize things when receiving the initial HTML payload from a server. But, as far as dynamic application go ("single-page apps", "ajax", client-side routing, etc), serialization and deserialization during runtime are completely unnecessary.

I believe that the current state of strings-only for attributes stem from the old days when everything was server-side rendering of HTML, so strings were fine. 

But, we're in a new era where single-page apps allow for dynamic experiences, and to make this change will help improve those experiences.

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

Received on Thursday, 9 June 2016 00:07:41 UTC