Hi
I ran into a problem with the use of $ in "my" plugins and I fear it's a problem we have to solve generally to avoid having incompatible plugins in Spartacus.
Almost all Javascript-Framworks use $. If more than one is used that leads to problems. This happens in s9y when the lightbox-plugin (using prototype) and commentedit or livecomment (using jQuery) are used. I fixed that in commentedit by calling noConflict and using jQuery instead of $, but wasn't aware that I of course have to do the same with the livecomment-plugin - in fact, all jQuery-code using $ will fail, also manually inserted one or code used in a template, if not modified accordingly.
So, I see two possibilities: 1. Only use one framework 2. All jQuery-code isn't allowed to use $.
The first possibility is very strict and could harm serendipity if something new, better, comes up, but if it's really only the lightbox-plugin, we could exchange that with a plugin using jQuery.
The second possibility could fail if we talk about more than two frameworks. Until know, I only know of prototype and jQuery being used, but what if another framework enters the stage which like prototype only wants to work with $?
Garvin, what do you think?
sincerely
JavaScript-Frameworks and Conflicts with $
Re: JavaScript-Frameworks and Conflicts with $
Personally, I have to say I find prototype's "why should we, if it works with prototype only" approach kind of ... erm ... odd, and I'd consider it a reason to not use prototype. At all. Especially in a system which is extendable by plugins.onli wrote:if it's really only the lightbox-plugin, we could exchange that with a plugin using jQuery
Anyway, there is at least a jQuery only implementation of LightBox. We'd have to check if there are implementations of other lightbox clones as well to fully replace the current plugin with a more reasonable alternative. Which I'd be in favor of.
YL