Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: it was impossible to remove array or object attributes when setting the JS prop to null. #1562

Open
wants to merge 1 commit into
base: skatejs-5.2.4
Choose a base branch
from

Conversation

trusktr
Copy link
Contributor

@trusktr trusktr commented Mar 4, 2019

  • Bug
  • Feature

Requirements

Rationale

It is impossible for prop.serialize to return null if it simply returns JSON.stringify(val), because a string can not be coerced to null, therefore doing something like this.someProp = null does not remove the target attribute.

Implementation

Checks if val is null, and if it is just returns null.

@trusktr trusktr requested a review from treshugart March 4, 2019 05:17
@treshugart
Copy link
Member

Is this still an issue in skatejs/element?

@trusktr
Copy link
Contributor Author

trusktr commented Mar 6, 2019

Seems like it is, here:

serialize: (elem, name, oldValue, newValue) => JSON.stringify(newValue)

Copy link
Member

@treshugart treshugart left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply. This looks pretty good, but would you mind writing a test for it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants