Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force velocity to attach itself to the window object even if jQuery is installed #932

Open
Zephni opened this issue Sep 18, 2021 · 1 comment

Comments

@Zephni
Copy link

Zephni commented Sep 18, 2021

Your system information

  • VelocityJS version: 2.0.6
  • Browser: Edge
  • Operating System: Windows

Checklist

  • Is this an issue with code?: Kind of
  • Is this an issue with documentation?: No
  • Have you reproduced this in other browsers?: Yes
  • Have you checked for updates?: Yes
  • Have you checked for similar open issues?: Yes

Please remember that this is an issue tracker, support requests should be posted on StackOverflow - see CONTRIBUTING.md

Please describe your issue in as much detail as possible:

I need to use the "non jQuery" version eg the standard JS function: Velocity() however if jQuery happens to be used on the same page velocity seems to prioritise the jQuery version and no longer attaches "Velocity" to the window object.

Is there something I can modify in the code manually to force velocity to attach it to the main object, or is there another way I can achieve this?

Finally, this may seem like a strange question because "why not just use the jquery version?", but in my use case I am including Velocity within a separate class, and my class does not require jQuery, so I am using the window Velocity function istead.. in other words I don't want my class to break just because jquery happens to be included on the page. If that makes sense.

@Rycochet
Copy link
Collaborator

Not sure what's going on with your setup, but the code quite literally cannot do that - it attaches to everything it can in order, and there is no branching or checking beyond "if the window exists start patching" - https://github.com/julianshapiro/velocity/blob/master/src/velocity.ts#L136-L160 and https://github.com/julianshapiro/velocity/blob/master/src/Velocity/patch.ts#L20-L26

Are there any error messages on startup?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants