HTML Git Diff View
Compare the original HTML text line by line alongside the reconstructed structural result.
The HTML result page provides two read-only views. Data Compare explains changes in the parsed tree and displays reconstructed HTML. Git Diff compares the original Base and Contrast text line by line.
Open Git Diff
- Enter Base and Contrast HTML and run a comparison.
- Use the view control in the result toolbar to switch from Data Compare to Git Diff.
- Review the original Base text on the left and Contrast text on the right.
Return to the editors to change either input. There are no HTML comparison settings in either result view.
Why the views can disagree
| Question | Data Compare | Git Diff |
|---|---|---|
| What is compared? | The parse5 virtual-node tree | The original text entered in each editor |
| How are children matched? | Fixed, order-sensitive LCS by node type and element tag | Not applicable; lines are compared as text |
| What is displayed? | HTML reconstructed from parsed nodes | The original source text |
| Does attribute order matter? | No; names and values are compared independently of order | Yes, when the source lines change |
| Does whitespace matter? | Whitespace-only nodes are ignored; meaningful non-empty text whitespace remains significant | Textual whitespace edits are visible |
| Are comments and doctypes included? | Yes, their parsed values are compared | Yes, their original source text is visible |
Changing indentation or attribute order can therefore leave Data Compare reporting Same while Git Diff shows edits. Conversely, Data Compare can align same-tag siblings through fixed LCS and report nested value changes, while Git Diff presents the same rearrangement as moved or rewritten lines. Neither view detects a semantic move operation.
Comments and doctypes are not ignored by Data Compare. Git Diff is still useful for reviewing their exact source spelling and placement alongside the structural result.
parse5 recovery and reconstructed output
parse5 can repair malformed markup or add implied document structure. Data Compare shows the resulting reconstructed tree, not an exact source mapping. Git Diff preserves the malformed or incomplete text as entered, which helps explain why the reconstructed result differs from the source.
A Same structural result means the parsed trees are equal under the fixed rules. It does not mean the source is identical or standards-valid. Use a dedicated HTML validator for conformance checks.
A practical review sequence
- Start in Data Compare to inspect added, deleted, and changed nodes or attributes.
- Check same-tag reordering carefully because fixed LCS remains order-sensitive.
- Switch to Git Diff to audit formatting, attribute layout, comments, doctypes, or parser-recovery differences in the original source.
See HTML Comparison Rules for the precise structural behavior.