Serialize get data-* from DOM, bypass data-* cache#92
Open
arturu wants to merge 2 commits intoRamonSmit:masterfrom
Open
Serialize get data-* from DOM, bypass data-* cache#92arturu wants to merge 2 commits intoRamonSmit:masterfrom
arturu wants to merge 2 commits intoRamonSmit:masterfrom
Conversation
Collaborator
|
@arturu I'm willing to merge this PR, but I have one issue: backward compatibility. Before your changes: [{"id":1,"value":"test"}]After your changes (Integer to string convertion): [{"id":"1","value":"test"}]Your issue can be fixed without this PR, you need change this line: $("#list-dd3 li[data-id=" + id + "]").attr('data-'+formInput[i],a);with $("#list-dd3 li[data-id=" + id + "]").data(formInput[i],a);and probably in this line: $("#list-dd3 li[data-id=" + id + "]").removeAttr('data-'+formInput[i]);you need to start using .removeData(). |
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 jQuery .data() function caching the data-attributes. If we need to dynamically edit the data attribute, the value isn't updated in the output.
Expected behavior
In this example the problem is fixed https://jsfiddle.net/4df99Lts/3/ (Nestable2 1.6.0-fixed)
Actual behavior
In this example the problem https://jsfiddle.net/4df99Lts/1/ (Nestable2 1.6.0)
Steps to reproduce the behavior
Touch "Configure" on ID: 5. Change value and save. In version https://jsfiddle.net/4df99Lts/3/ the problem is fixed, also, in the https://jsfiddle.net/4df99Lts/1/ no.
Best regards