Skip to content
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

Clone-replace for alfa-dom Nodes #1523

Merged
merged 24 commits into from
Dec 7, 2023
Merged

Clone-replace for alfa-dom Nodes #1523

merged 24 commits into from
Dec 7, 2023

Conversation

rcj-siteimprove
Copy link
Contributor

@rcj-siteimprove rcj-siteimprove commented Dec 4, 2023

We introduce new functions for cloning a DOM-tree with the option of replacing elements based on a predicate. A clone will be a new instance structurally equal to the original, but physically different.

The main use case is for a situation where we want to audit a document with some elements replaced to see how the modification impacts the result and since trees in Alfa are immutable, we do that by cloning and replacing.

@rcj-siteimprove
Copy link
Contributor Author

!pr extract

@rcj-siteimprove rcj-siteimprove added the minor Backwards-compatible change that touches public API label Dec 4, 2023
@rcj-siteimprove rcj-siteimprove self-assigned this Dec 4, 2023
@rcj-siteimprove rcj-siteimprove marked this pull request as ready for review December 4, 2023 12:58
@rcj-siteimprove rcj-siteimprove requested a review from a team as a code owner December 4, 2023 12:58
packages/alfa-dom/src/node.ts Outdated Show resolved Hide resolved
packages/alfa-dom/src/node.ts Outdated Show resolved Hide resolved
packages/alfa-dom/src/node.ts Outdated Show resolved Hide resolved
packages/alfa-dom/src/node.ts Outdated Show resolved Hide resolved
packages/alfa-dom/src/node/document.ts Outdated Show resolved Hide resolved
packages/alfa-dom/src/node/element.ts Outdated Show resolved Hide resolved
packages/alfa-dom/test/node.spec.tsx Outdated Show resolved Hide resolved
packages/alfa-dom/test/node.spec.tsx Show resolved Hide resolved
@rcj-siteimprove
Copy link
Contributor Author

!pr extract

@rcj-siteimprove
Copy link
Contributor Author

!pr extract

@rcj-siteimprove
Copy link
Contributor Author

Ready for re-review, though still with a few un-resolved comments that could perhaps be split into new tasks, if they are non-blocking for this.

@rcj-siteimprove rcj-siteimprove requested a review from Jym77 December 7, 2023 08:34
Copy link
Contributor

@Jym77 Jym77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Some minor polish and streamlining.

packages/alfa-dom/src/node/element.ts Outdated Show resolved Hide resolved
packages/alfa-dom/test/node.spec.tsx Outdated Show resolved Hide resolved
packages/alfa-dom/test/node.spec.tsx Outdated Show resolved Hide resolved
@rcj-siteimprove
Copy link
Contributor Author

!pr extract

@rcj-siteimprove rcj-siteimprove requested a review from Jym77 December 7, 2023 13:01
Jym77
Jym77 previously approved these changes Dec 7, 2023
packages/alfa-dom/test/node.spec.tsx Outdated Show resolved Hide resolved
packages/alfa-dom/src/node/element.ts Outdated Show resolved Hide resolved
@rcj-siteimprove rcj-siteimprove added this pull request to the merge queue Dec 7, 2023
Merged via the queue into main with commit 2ce1a8c Dec 7, 2023
6 checks passed
@rcj-siteimprove rcj-siteimprove deleted the node-cloning branch December 7, 2023 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Backwards-compatible change that touches public API
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants