Skip to content

[BUG] Comment syntax error causing a crash #1124

@jaspertandy

Description

@jaspertandy

Describe the bug

This block of comments: https://github.com/juliangarnier/anime/blob/master/src/events/scroll.js#L749-L768

Starts with a /*, which means the following lines' // up to and including line 760 do nothing. Then on line 760, the */ at the end of the docblock comment breaks out of the comment, causing ($el.parentElement) to be executed and crash, because seemingly $el is not always defined.

This only happens occasionally on one of our projects, but it's happening all the time on another.

Fix for this is to replace the /* at the start of line 749 with a //.

Example error:

scroll.js:716 Uncaught TypeError: Cannot read properties of null (reading 'parentElement')
    at ScrollObserver.updateBounds (scroll.js:716:47)
    at ScrollObserver.refresh (scroll.js:546:10)
    at scroll.js:223:13
    at forEachChildren (helpers.js:222:5)
    at ScrollContainer.refreshScrollObservers (scroll.js:222:5)
    at Timer.onComplete (scroll.js:152:14)
    at render (render.js:304:20)
    at tick (render.js:328:3)
    at Engine.update (engine.js:55:11)
    at tickEngine (engine.js:154:12)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions