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

$.fn.scope undefined when using CommonJS #1288

Closed
ccummings opened this issue Oct 27, 2014 · 4 comments · Fixed by #1311
Closed

$.fn.scope undefined when using CommonJS #1288

ccummings opened this issue Oct 27, 2014 · 4 comments · Fixed by #1311
Assignees
Labels
Milestone

Comments

@ccummings
Copy link
Contributor

I'm using CanJS in a Browserify application and noticed the scope jQuery plugin is not defined.

This happens because can.Component checks if window.$ is defined before adding the plugin but in a CommonJS environment, jQuery does not add $ to window.

Source: https://github.com/bitovi/canjs/blob/master/component/component.js#L423

I think a much safer check would be window.jQuery since that always seems to be exposed.

@ccummings ccummings self-assigned this Oct 27, 2014
@daffl daffl added this to the 2.1.4 milestone Oct 27, 2014
@Macrofig Macrofig assigned Macrofig and unassigned ccummings Nov 4, 2014
@daffl daffl added the bug label Nov 5, 2014
@justinbmeyer
Copy link
Contributor

I am using browserify too and just noticed this problem. I think the correct solution would be to check for can.$.fn

@Macrofig
Copy link
Contributor

I thought the solution was to not do this at all and, instead, have the check for jQuery abstracted from can.component. Or are you saying to use can.$.fn in the mean time?

@justinbmeyer
Copy link
Contributor

I mean if(can.$.fn) { can.$.fn = function{ ... } }

But people can use $().scope()

@justinbmeyer
Copy link
Contributor

Basically, we shouldn't be checking for jQuery. If can.$ is an interface to the underlying library's nodeList. Perhaps can.$.fn should be its interface to adding additional methods to it.

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

Successfully merging a pull request may close this issue.

4 participants