Skip to content

Class pace-done added to body multiple times #515

Description

@matt-snider

Hi there,

Thanks for this great library! It looks great and works very well, although I am having one minor issue.

Recently I noticed that on each navigation or request, the pace-done class is being added to body and not properly cleared on the next run. This doesn't affect the functionality, but over time, many duplicate instances of this class accumulate.

screenshot-2021-02-25T11:30:43

The fact that no one else has reported this leads me to believe that I might be making a mistake, or there is some issue specific to my setup. But I guess we'll see if anyone else reports the same behaviour. I'm hoping that someone might have some idea what could be causing this.

Some information that might be helpful:

Activity

  1. wsteven24 commented on Aug 19, 2021

    @wsteven24

    Same issue over here. I'm using v1.2.4
    image

  2. michaelthedev commented on Nov 14, 2021

    @michaelthedev

    Having the same issue also. Keeps adding unnecessary spaces too
    image

  3. SlavaEgorov commented on Nov 19, 2021

    @SlavaEgorov

    Same for me

  4. browniebraun commented on Dec 14, 2021

    @browniebraun

    There is a pipe within the search pattern to replace pace-done by class pace-running which should not be in.

    Replace line 276:
    document.body.className = document.body.className.replace(/(pace-done )|/, 'pace-running ');

    by

    document.body.className = document.body.className.replace(/(pace-done )/, 'pace-running ');

    Afterwards it will stop that nasty misbehavior.

    Regards
    -Andi

  5. matt-snider commented on Dec 14, 2021

    @matt-snider
    Author

    @browniebraun Would you like to open a PR with this change?

  6. michaelthedev commented on Oct 10, 2024

    @michaelthedev

    Hi @matt-snider Could this be added to the next update please? It's still happening on the latest version (https://cdn.jsdelivr.net/npm/pace-js@latest/pace.min.js)

  7. CodeByZach commented on Oct 10, 2024

    @CodeByZach
    Owner

    Hi @michaelthedev! Have you submitted a PR?

  8. michaelthedev commented on Oct 10, 2024

    @michaelthedev

    oh, i tagged the wrong person. I just created the PR (#547)

    I wasn't able to apply the fix on the minified version

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions