Dispatch pjax:end
event on native document
#861
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.
Problem
GitHub's own pjax implementation dispatches its events directly in the DOM, while the jQuery pjax library we use here dispatches its events only within its jQuery instance.
Because some GitHub add-ons listen to certain pjax events in the DOM it may be necessary to forward an event from jQuery to the DOM to make sure those add-ons don't break.
Fixes #490
Solution
Dispatch the
pjax:start
andpjax:end
events (for now) in the native DOM whenever they're dispatched within jQuery.Note that I don't forward the event details/extra parameters or whether they're cancellable at the moment, because the pjax implementations differ in this case and I could not find a case where this info is used by listeners.
Screenshots
Before this PR when navigating through Octotree:
After the PR or when navigating though GitHub or reloading the page manually:
As can be seen on the second screenshot, Refined GitHub adds gray dots to show the whitespace and OctoLinker adds pink dots to indicate that you can navigate to the required libraries.
As I have no experience in browser add-on development and there's no documentation how I could build and install my local Octotree development version in my Firefox, I don't know how to verify if the solution is working. But I've done a lot of research and digging through (minified) JavaScript and am therefore pretty confident it does.
So, could you please verify this?