Skip to content

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

Open

Description

@paolof76

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();
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions