1. Luke Plant
  2. semanticeditor
  3. Pull requests

Pull requests

#4 Declined
Deleted repository
default (03144ead2552)

Fixes issue #40 - jQuery namespacing issues on django1.4 and django-cms 2.3 update

  1. Zak Patterson

After this, current state of django-cms repo and Django 1.4 work well with semanticeditor.

Comments (3)

  1. Luke Plant repo owner

    I can't see why this would possibly work. All it does is wrap the code in a closure, and passes in exactly the same jQuery instance that was being accessed directly.

    The only difference is that PresentationControls is no longer exported.

  2. Luke Plant repo owner

    Ah, I see - it works because the closure holds on to the jQuery reference as it is defined at the time the code is called, so that even when jQuery is redefined later we've still got the original jQuery reference, which has the necessary plugins attached.

    I'm going to reject this pull request because it is a very noisy way of adding the necessary lines. Thanks for the patch though.

    1. Zak Patterson author

      Hi Luke, It's true, adding the closure only protects this script code from future changes to the jQuery name as a reference. So if someone after this script someone points the jQuery reference to a different instance, we're protected, however if someone does jQuery.fn = undefined, or wipes out some other part of the jQuery object or some jQuery plugin that Semantic would rely on, this will not help.

      So perhaps it's wrong to call this a bug with Semantic, as I contend that there should only ever be one jQuery instance. I just used this method and debugged it this way to work with my site. It's the most frustrating quirk of jQuery usage that I've encountered, since jQuery usage relies heavily on $(document).ready, it seems you can't do much to protect yourself against other users of jQuery as all callers of $(document).ready will end up using the final object as manipulated by different scripts which may follow the one from your project.

      As for PresentationControls, maybe that wymeditor.semantic.js should be tweaked so it's

      var PresentationControls;
        PresentationControls = function(wym,opts){

      Anyway I'm happy to be adding SemanticEditor to my latest site, thanks for the project.