Enhance Magnifier Functionality for Cross-Mode Compatibility#5
Open
suhailshub-arch wants to merge 1 commit into
Open
Enhance Magnifier Functionality for Cross-Mode Compatibility#5suhailshub-arch wants to merge 1 commit into
suhailshub-arch wants to merge 1 commit into
Conversation
…set logic for standards and quirks mode compatibility in html-magnifier.js.
donhatch
reviewed
Jul 6, 2024
There was a problem hiding this comment.
I don't think the || is going to work as intended.
Consider the case when window.pageXOffset is 0; then you want it to be used (if I understand correctly), but it looks like this code will use document.documentElement.scrollLeft instead (which might not exist, depending on the platform; I'm not sure what the possibilities are).
There was a problem hiding this comment.
Oh, I see, I guess it could still work, it's just pretty mind-bending. I withdraw my objection :-)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request addresses an issue where the magnifier feature failed to synchronize correctly when scrolling across different document modes (standards mode and quirks mode).
The fix involves updating the logic for calculating scroll offsets to ensure compatibility with both modes. By prioritizing window.pageXOffset and window.pageYOffset for scroll positions which works in both standards and quirks mode, and falling back to document.documentElement.scrollLeft/document.documentElement.scrollTop where necessary (when older browsers are used), we achieve consistent behavior across all browsers and document modes.
This update ensures a seamless user experience with the magnifier feature regardless of the document rendering mode.
Note: document.documentElement.scrollLeft and document.documentElement.scrollTop only works in standards mode