Closed
Conversation
The serialization (`.toAttribute`) is handle by `String` at https://github.com/Polymer/lit-element/blob/master/src/lib/updating-element.ts#L293-L298
|
@kenchris @justinfagnani Could you comment on this issue please? My understanding from what @vicb points out is that this happens: const MyObject = {
toAttribute: /* ... custom toAttribute */
fromAttribute: /* ... custom fromAttribute */
};
const myFunction = /* ... myFunction */ ;
//...
// property declarations:
{ x: { type: Number } } // serializer is String constructor, deserializer is Number constructor
{ y: { type: MyObject } } // serializer is custom toAttribute, deserializer is custom fromAttribute
{ z: { type: myFunction } } // serializer is String constructor, deserializer is myFunctionWe also have: // don't do this
{ w: { type: Object } }
// Serializer is String constructor
// Deserializer is Object constructor, produces something weird e.g. { 0: "{", 1: "a", 2: ":", 3: "'", ... } Just wanted to check with you both because of this commit: b4c5f51 |
|
@sorvell fyi |
|
Just saw this #369 which probably changes things |
Contributor
Author
|
@katejeffreys yep it should change. I added a note there because it should have been updated. Feel free to close this PR (maybe after #369 is updated ?) |
Member
|
@vicb @katejeffreys I just added some more info regarding the change in #369 to #375 (comment) |
Contributor
Author
|
lg |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The serialization (
.toAttribute) is handled byStringat https://github.com/Polymer/lit-element/blob/4b20f80bc3145b0a0f7421f23d9a9f9e3d43e922/src/lib/updating-element.ts#L293-L298