DigiLive/jQuery-Merge-for-php-diff

I encountered a problem when merging why some more commas

djfly opened this issue · 21 comments

<h3>,   sfdfsdfsf,</h3>,<p>,    <br />,</p>,<hr />,,<p>,    <br />,</p>,<blockquote>,   fdsfdsfsdfdsf 45454545,</blockquote>

The Merge results will be a lot more commas?

@Xiphe Emergency help

Hey @djfly
Can you please provide the source documents that you're trying to merge?
Don't know how to reproduce this

in example/index.php

<script type="text/javascript">
            jQuery(document).ready(function($) {
                $('.Differences').phpdiffmerge({
                    left: left,
                    right: right,
                    pupupResult: true,
                    debug: true,
                    merged: function(a,b,c) {
                        alert(a); // add this look it
                        console.log('Merge completed.');
                    }
                });
            });
        </script>

yeah, i meant more the contents of left and right

left and right is your example default
you can just add alert(a); // add this look it in your example to reproduce it

aaah, sorry i accidentally deleted your first comment. Don't know how to restore it :(

Does not matter, are you reproduce it?

Sorry - I don't get it. The example uses a.txt and b.txt from the example folder there are no commas and no fdsfdsfsdfdsf 45454545, so i do not understand where that strings come from.

qq 20141110223121
See Figure merge results yet? A lot more commas

Each line at end added ,

Ah, thats weird...
Which browser are you using?
Looks to me as if the way i open the popup does not go well with your browser.

Yeah, that's right. looks as if the browser uses , instead of \n...

the popup view originally was more a debugging tool. and i left it in because i thought that somebody might need it.

I'd recommend not using the build in popup thing and just use the merge result here.

in chrome and ie 11 both Have this problem, this is not browser problem
popup result is right
merge result is not right

i see, going to check that

Thank God, you finally understand.

:)

Got it! Since left and right are arrays of strings, the merge result is also an array. if you alert an array it will stringify that array using commas

alert(['foo', 'bar']); -> foo,bar

what you need to do is join the array with your favorite line break

alert(result.join("\n"));

going to make that more clear in the docs.

thanks, Finally solved.

you're welcome :)

Finally, my project is done!
visit:http://wegit.org/