Undefined Masonry Library JavaScript Crash on FAQ Pages - #560
Open
aniket866 wants to merge 1 commit into
Open
Conversation
Signed-off-by: aniket866 <iamaniketkumarmaner@gmail.com>
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.
Closes #558
Description
The theme initialization script
script.jstries to instantiate a Masonry instance on the.masonry-wrapperelement, but the Masonry library is not loaded or imported anywhere on the site.Why It Breaks
When a user visits the FAQ page (which includes the
.masonry-wrapperclass), the onload function matches the element and callsnew Masonry(...). Since the Masonry dependency is not loaded in the HTML or project modules, this throws a fatalReferenceError: Masonry is not definedand crashes the JavaScript runtime context on the page.How to Reproduce
ReferenceError: Masonry is not defined.Reproduction Flow
graph TD A[Start: Load FAQ Page] --> B[HTML renders element with .masonry-wrapper] B --> C[window.onload event fires] C --> D[Script queries wrapper element] D --> E{Wrapper found?} E -- Yes --> F[Execute: new Masonry()] F --> G{Is Masonry loaded in namespace?} G -- No --> H[Crash: ReferenceError: Masonry is not defined] H --> I[Subsequent page JS execution fails]