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

Remove use of DOMNodeInserted in our code #1011

Merged
merged 1 commit into from
Aug 17, 2024

Conversation

makyen
Copy link
Contributor

@makyen makyen commented Aug 17, 2024

Chrome removed use of DOMNodeInserted event. We currently explicitly use that event only to show the appropriate tab for post bodies. We already have code that executes when post bodies are added to the DOM in order to render the post preview. The code to detect when a post body is added to the DOM is effectively duplicated here to select the correct tab.

NOTE: This is not as generically effective as a MutationObserver watching for all DOM node insertions in the <body> would be, but is substantially more efficient. The main drawback is that if a new way to add a post body is added to the code base, it may be necessary to add additional way(s) to detect that the post body has been added to the DOM (such as the special case used for the review pages).

In addition, this may not remove all uses of the DOM node events which Chrome has removed, as I have not, yet, checked to see if any of our dependencies use those events.

Chrome removed DOMNodeInserted. We currently explicitly use that event
only to show the appropriate tab for post bodies. We already have code
that executes when post bodies are added to the DOM in order to render
the post preview. The code to detect when a post body is added to the
DOM is effectively duplicated here to select the correct tab.

NOTE: This is not as generically effective as a MutationObserver watching
for all DOM node insertions in the <body> would be, but is substantially
more efficient. The main drawback is that if a new way to add a post body
is added to the code base, it may be necessary to add additional way(s) to
detect that the post body has been added to the DOM (such as the special
case used for the review pages).
@makyen makyen merged commit 9a0adbe into Charcoal-SE:master Aug 17, 2024
3 checks passed
@makyen makyen deleted the Mak-remove-DOMNodeInserted branch August 17, 2024 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant