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

Table TD cells are mis-nested during comparison #5

Closed
dmitry-pavlov opened this Issue Mar 21, 2012 · 3 comments

Comments

Projects
None yet
2 participants
@dmitry-pavlov

dmitry-pavlov commented Mar 21, 2012

I have made a diff for 2 HTML files that have a tables inside. Table cells are colspan-ed and rowspan-ed. As the result I see that TD cells are mis-nested (it seems - due to different styles - not sure).

The test files for the issue I am describing are available here: http://dimaka.com/download/Issue_html_diff_tables.zip

You could see below - that difference is the only styles - not the text content. In short, the problem looks like this one:

In SOURCE html file it was:

            <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.5pt;
                border-left-color: #000000; border-left-style: solid; border-left-width: 0.5pt;
                border-right-color: #000000; border-right-style: solid; border-right-width: 0.5pt;
                border-top-color: #000000; border-top-style: solid; border-top-width: 0.5pt;
                padding-left: 5.4pt; padding-right: 5.4pt; vertical-align: top; width: 198.45pt">
                <h1 style="margin: 12pt 0pt 3pt; page-break-after: avoid">
                    <span style="font-family: Cambria; font-size: 16pt; font-weight: bold">History Notes:</span></h1>
            </td>

In TARGET html file it was:

            <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.5pt;
                border-left-color: #000000; border-left-style: solid; border-left-width: 0.5pt;
                border-right-color: #000000; border-right-style: solid; border-right-width: 0.5pt;
                border-top-color: #000000; border-top-style: solid; border-top-width: 0.5pt;
                padding-left: 5.4pt; padding-right: 5.4pt; vertical-align: top; width: 191.35pt">
                <h1 style="margin: 12pt 0pt 3pt; page-break-after: avoid">
                    <span style="font-family: Cambria; font-size: 16pt; font-weight: bold">History Notes:</span></h1>
            </td>

In DIFF_RESULTS html file it becomes wrong (opening TD tag):

            <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.5pt;
                border-left-color: #000000; border-left-style: solid; border-left-width: 0.5pt;
                border-right-color: #000000; border-right-style: solid; border-right-width: 0.5pt;
                border-top-color: #000000; border-top-style: solid; border-top-width: 0.5pt;
                padding-left: 5.4pt; padding-right: 5.4pt; vertical-align: top; width: 198.45pt">
                <td style="border-bottom-color: #000000; border-bottom-style: solid; border-bottom-width: 0.5pt;
                    border-left-color: #000000; border-left-style: solid; border-left-width: 0.5pt;
                    border-right-color: #000000; border-right-style: solid; border-right-width: 0.5pt;
                    border-top-color: #000000; border-top-style: solid; border-top-width: 0.5pt;
                    padding-left: 5.4pt; padding-right: 5.4pt; vertical-align: top; width: 191.35pt">
                    <h1 style="margin: 12pt 0pt 3pt; page-break-after: avoid">
                        <span style="font-family: Cambria; font-size: 16pt; font-weight: bold">History Notes:</span></h1>
                </td>

Please let me know how to fix it? And if you are going to update the sources - when it could happen?
Thank you in advance!

@Rohland

This comment has been minimized.

Show comment
Hide comment
@Rohland

Rohland Mar 22, 2012

Owner

Hi Dmitry,

You've spotted a bug. The issue is that the attribute for the td differs. The culprit is the width. In the source it's 198.45, in the target it is 191.35.

Attribute changes aren't really supported. In general, I think we should actually ignore them as it's difficult to assess whether to highlight changes to attributes or not. I've updated the code to ignore attributes, but this could cause some unexpected issues. I've added a new test case and all existing tests are passing so I would be keen to get your feedback.

I've pushed the change.

Owner

Rohland commented Mar 22, 2012

Hi Dmitry,

You've spotted a bug. The issue is that the attribute for the td differs. The culprit is the width. In the source it's 198.45, in the target it is 191.35.

Attribute changes aren't really supported. In general, I think we should actually ignore them as it's difficult to assess whether to highlight changes to attributes or not. I've updated the code to ignore attributes, but this could cause some unexpected issues. I've added a new test case and all existing tests are passing so I would be keen to get your feedback.

I've pushed the change.

@dmitry-pavlov

This comment has been minimized.

Show comment
Hide comment
@dmitry-pavlov

dmitry-pavlov Mar 23, 2012

Hi Rohland,

Thanks for reply! I will have a look at the changes you pushed and get back with the feedback to you.

dmitry-pavlov commented Mar 23, 2012

Hi Rohland,

Thanks for reply! I will have a look at the changes you pushed and get back with the feedback to you.

@Rohland Rohland closed this May 1, 2012

@dmitry-pavlov

This comment has been minimized.

Show comment
Hide comment
@dmitry-pavlov

dmitry-pavlov May 21, 2012

This fix did the trick at least for simple cases when some table cells are merged. Thank you!

dmitry-pavlov commented May 21, 2012

This fix did the trick at least for simple cases when some table cells are merged. Thank you!

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