Remove use of DOMNodeInserted in our code #1011
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.