Skip to content

Commit 7f5530c

Browse files
Apply suggestions from code review
Co-authored-by: Simon H <[email protected]>
1 parent c273294 commit 7f5530c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/svelte/tests/html_equal.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ function clean_children(node, opts) {
2626
});
2727

2828
attributes.forEach((attr) => {
29+
// Strip out the special onload/onerror hydration events from the test output
2930
if ((attr.name === 'onload' || attr.name === 'onerror') && attr.value === 'this.__e=event') {
3031
return;
3132
}
@@ -67,6 +68,7 @@ function clean_children(node, opts) {
6768
continue;
6869
}
6970

71+
// add newlines for better readability and potentially recurse into children
7072
if (child.nodeType === 1 || child.nodeType === 8) {
7173
if (previous?.nodeType === 3) {
7274
const prev = /** @type {Text} */ (previous);
@@ -95,6 +97,7 @@ function clean_children(node, opts) {
9597
text.data = text.data.trimEnd();
9698
}
9799

100+
// indent code for better readability
98101
if (has_element_children && node.parentNode) {
99102
node.innerHTML = `\n\ ${node.innerHTML.replace(/\n/g, '\n ')}\n`;
100103
}

0 commit comments

Comments
 (0)