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

fix: don't infinitely set the src which triggers the mutation observe… #287

Merged
merged 1 commit into from
Dec 5, 2024

Conversation

mlohstroh
Copy link
Contributor

If you are using patchUrlMappings with patchSrcAttributes set to true, and there is an element who's source is not in the mapping list, the remapping would essentially do element.src = element.src which would re-trigger the mutation observer again causing the page to deadlock.

@mlohstroh mlohstroh requested a review from afgiel December 5, 2024 17:32
@mlohstroh mlohstroh merged commit 7adc57e into main Dec 5, 2024
4 checks passed
@mlohstroh mlohstroh deleted the fix/recursive-remapping branch December 5, 2024 17:49
@@ -127,15 +127,20 @@ function recursivelyRemapChildNodes(node: Node, mappings: Mapping[]) {

function attemptSetNodeSrc(node: Node, mappings: Mapping[]) {
if (node instanceof HTMLElement && node.hasAttribute('src')) {

Choose a reason for hiding this comment

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

Hey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants