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

When one of settings.originalContent && settings.changedContent are empty #12

Open
paolof76 opened this issue Aug 5, 2015 · 0 comments

Comments

@paolof76
Copy link

paolof76 commented Aug 5, 2015

When one of the two values are empty, the diff is not shown in case of originalContent and changedContent are passed as parameters.

Example (pass an empty originalContent):

$("input[type=button2]").click(function () {
$("#wrapper tr").prettyTextDiff({
cleanup: $("#cleanup").is(":checked"),
originalContent: "",
changedContent: "Some more text which can be passed to this function.",
diffContainer: ".diff2"
});
});

A quick fix I found to let it work is to split the if (settings.originalContent && settings.changedContent) {} in two separate checks:
if (settings.originalContent) {
original = $('

').html(settings.originalContent).text();
} else {
original = $(settings.originalContainer, this).text();
}
if (settings.changedContent) {
changed = $('
').html(settings.changedContent).text();
} else {
changed = $(settings.changedContainer, this).text();
}

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

No branches or pull requests

1 participant