jQuery.PrettyTextDiff
jQuery.PrettyTextDiff copied to clipboard
When one of settings.originalContent && settings.changedContent are empty
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(); }