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

PR 65 has had some interesting side-effects #74

Closed
i-like-robots opened this issue Mar 10, 2015 · 1 comment
Closed

PR 65 has had some interesting side-effects #74

i-like-robots opened this issue Mar 10, 2015 · 1 comment

Comments

@i-like-robots
Copy link

This may not be a bug report as such but an interesting issue.

The changes made in #65 may introduce a new issue for users using jQuery or other libraries.

At Lonely Planet we use the nice Jasmine jQuery utility to load fixtures, spy on events etc.

Jasmine jQuery is not AMD compatible so we simply load it in as a helper script. This is also requires that we load jQuery onto the page first, done with the vendor option for the main Jasmine Grunt task.

Because RequireJS is now being loaded after the vendor and helper scripts jQuery is not registering itself as an AMD module. This means our AMD specs are loading in a new version of jQuery which introduces some interesting bugs.

As the two versions of jQuery are not the same internal data set by one instance is not shared with the other. For instance, event handlers are stored internally against an element. Jasmine jQuery features a useful spyOnEvent function which binds a simple handler, however because this is bound by the first version of jQuery loaded onto the page it is not triggered when the specs are run because they're dispatching events using a different jQuery instance.

I'm not sure what the best solution to this problem is but it's quite insidious to debug!

@cloudchen
Copy link
Owner

Will fix it by compromise. Thanks for sharing your thoughts.

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