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

Breaks with jQuery in noconflict mode #124

Open
Manfred1ni opened this issue Aug 17, 2015 · 4 comments
Open

Breaks with jQuery in noconflict mode #124

Manfred1ni opened this issue Aug 17, 2015 · 4 comments

Comments

@Manfred1ni
Copy link

Hello,

The plug-in does not seem to works when jQuery is in no conflict mode and that prototype is used.

After loading jquery and prototype on the same page, and setting jquery up in no-conflict mode, I observed a strange behaviour from hover-dropdown. The elements I hovered on appeared as expected, but the whole thing disappeared when I hovered off. Not just the menu, the button too. A "display: none" was added to the element's style.

This behaviour was observed for my custom elements, but I also checked with copy pasted elements from your demo site to confirm the issue. It still disappeared completely.

The workaround is to replace '$' by 'jQuery' in the code. I'm not sure this is worth changing, as very few people would have to work with prototype. I just wanted to signal the problem.

EDIT : It does not seems that simple after all. Even with 'jQuery' instead of '$' in the code, my elements still disappear when I setup jQuery in no-conflict mode.

Regards,
Manfred

@CWSpear
Copy link
Collaborator

CWSpear commented Aug 17, 2015

Yeah, not sure what's going on, but if you look at the last line of the code, it's passing jQuery into the closure wrapping all the code and only using $ locally, so it doesn't have anything to do with a conflict, since it's properly using the jQuery variable.

So it definitely works if you don't use no conflict mode? Or do you have something else going on? Does it work normally without this plugin installed (i.e. by using Bootstrap's default behavior to click to activate the menu and then if you click off, it does what you expect, etc?).

@Manfred1ni
Copy link
Author

I made a matrix with all the possibilities :
matric_jquery_prototype_dropdown

By webapp I mean widget that requires prototype.js to work.
Obviously, the webapp does not work as long as prototype is not loaded or jQuery is not in no-conflict mode. But when they are both enabled, the dropdown does not work anymore, be it your dropdown-hover or bootstrap's dropdown.

Seeing this last result, it seems to be an issue for bootstrap itself, and not the hover plugin. I am not really familiar with github, do you know if we can/must/should move the subject ?

@CWSpear
Copy link
Collaborator

CWSpear commented Aug 18, 2015

Where are you calling jQuery.noConflict()?

@Manfred1ni
Copy link
Author

I have a Durandal application, so before app.start(), but after jQuery is loaded (if that was your hidden question ?).

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