You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Sep 28, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Sep 28, 2026. It is now read-only.
Tables with rowspan or colspan is treated as invalid table #7
This is a known limitation - colspan and rowspan present and not equal to "1" make visual-dom-diff bail out and show that the old table was removed and a new one added.
The problem is with keeping columns always properly aligned which is really necessary to make diffs understandable to users. Given the complexity of this task, I decided to focus on the most common case first and bail out in case certain preconditions are not met, one of which is colspan and rowspan must equal 1.
It is definitely possible to extend the base algorithm to handle colspan and rowspan greater than 1, at least in some cases, though it might still be necessary to place some restrictions in order to keep the result user-friendly. Unfortunately, I won't have time to implement it any time soon but I'd certainly welcome a PR.
Would you mind pointing me to the section of the code where this behavior could be happening? I may be able to take a look and see if I find something relevant to make a PR.
I did another test using the underlying diff-match-patch dependency and it doesn't not find any difference when using the same table. I pasted the same table from the previous comment twice in https://neil.fraser.name/software/diff_match_patch/demos/diff.html and no difference is shown.
I jumped deeply in the code of visual-dom-diff but I wasn't able to figure it out how to solve this issue 😞
I haven't thought through the intricacies of how to show the table diff (if it is present) in a user-friendly way when it has colspan or rowspan not equal to 1, but perhaps as a first pass it could be useful to at least make visual-dom-diff not show a diff when there was no change in the table? @gkubisa would you accept a PR for a quick workaround like this?
Activity
gkubisa commentedon Dec 9, 2019
This is a known limitation -
colspanandrowspanpresent and not equal to "1" makevisual-dom-diffbail out and show that the old table was removed and a new one added.The problem is with keeping columns always properly aligned which is really necessary to make diffs understandable to users. Given the complexity of this task, I decided to focus on the most common case first and bail out in case certain preconditions are not met, one of which is colspan and rowspan must equal 1.
It is definitely possible to extend the base algorithm to handle colspan and rowspan greater than 1, at least in some cases, though it might still be necessary to place some restrictions in order to keep the result user-friendly. Unfortunately, I won't have time to implement it any time soon but I'd certainly welcome a PR.
humitos commentedon Jul 18, 2024
I just found this issue and I'm not sure to understand if I'm hitting the same issue one or not.
I used the following HTML snippet to test it:
I paste it twice in https://teamwork.github.io/visual-dom-diff/ and I'm seeing the whole table being deleted and added. Am I doing something wrong here?
Would you mind pointing me to the section of the code where this behavior could be happening? I may be able to take a look and see if I find something relevant to make a PR.
humitos commentedon Feb 4, 2025
I did another test using the underlying
diff-match-patchdependency and it doesn't not find any difference when using the same table. I pasted the same table from the previous comment twice in https://neil.fraser.name/software/diff_match_patch/demos/diff.html and no difference is shown.I jumped deeply in the code of
visual-dom-diffbut I wasn't able to figure it out how to solve this issue 😞humitos commentedon Feb 26, 2025
The issue that I reported here was solved by #46
zmbc commentedon Sep 24, 2026
I haven't thought through the intricacies of how to show the table diff (if it is present) in a user-friendly way when it has colspan or rowspan not equal to 1, but perhaps as a first pass it could be useful to at least make
visual-dom-diffnot show a diff when there was no change in the table? @gkubisa would you accept a PR for a quick workaround like this?