Skip to content

Commit 10c8511

Browse files
authored
ADD: diff:ignoreChildren and diff:ignoreAttributes description to docs (#572)
* ADD: diff:ignoreChildren and diff:ignoreAttributes description to docs * FIX: diff:ignoreChildren and diff:ignoreAttributes description to docs
1 parent de43d32 commit 10c8511

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

docs/site/docs/verification/semantic-html-comparison.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,29 @@ Here are the customization options you have available to you:
4646
</header>
4747
```
4848

49+
- **Ignore children:** Use the `diff:ignoreChildren` attribute (no value is needed) to ignore all child nodes/elements of an element. This does not include attributes. For example, to ignore all child nodes of the `h1` element, do the following:
50+
51+
```html
52+
<header>
53+
<h1 diff:ignoreChildren>Hello <span>world</span></h1>
54+
</header>
55+
```
56+
57+
- **Ignore all attributes:** Use the `diff:ignoreAttributes` attribute (no value is needed) to ignore all attributes of an element. For example:
58+
59+
```html
60+
<header>
61+
<h1 diff:ignoreAttributes>Hello world</h1>
62+
</header>
63+
```
64+
65+
> [!NOTE]
66+
> The `diff:ignoreChildren` and `diff:ignoreAttributes` attributes can be combined to ignore all child nodes/element *and* attributes of an element, but still verify that the element itself exists. For example:
67+
```html
68+
<header>
69+
<h1 diff:ignoreChildren diff:ignoreAttributes>Hello world</h1>
70+
</header>
71+
4972
- **Configure whitespace handling:** By default, all nodes and elements are compared using the `Normalize` whitespace handling option. The `Normalize` option will trim all text nodes and replace two or more whitespace characters with a single space character. The other options are `Preserve`, which will leave all whitespace unchanged, and `RemoveWhitespaceNodes`, which will only remove empty text nodes.
5073

5174
To override the default option, use the `diff:whitespace` attribute, and pass one of the three options to it. For example:

0 commit comments

Comments
 (0)