WordPress.org

Ready to get started?Download WordPress

Forums

Jetpack by WordPress.com
Backbone Collision (5 posts)

  1. Collin Donahue-Oponski
    Member
    Posted 1 year ago #

    Hi,

    I develop a plugin that also uses Backbone. I've never had a library collision related to backbone before, and the collision is my fault (I was concatenating several JS files and enqueuing as one file), but once I fix it on my end, I think there will still be a potential problem on your end.

    In jetpack/modules/notes.php, when you guys are calling wp_enqueue_script, you're specifying the script version as JETPACK_NOTES__CACHE_BUSTER instead of the actual version of the script, where JETPACK_NOTES__CACHE_BUSTER is defined as JETPACK__VERSION . '-' . gmdate( 'oW' ).

    Won't that create problems for everyone else trying to use backbone? Won't we be forced to support the same version of backbone that Jetpack supports? The same goes for underscore and possibly other scripts enqueued in that file.

    http://wordpress.org/extend/plugins/jetpack/

  2. designsimply
    Member
    Plugin Contributor

    Posted 1 year ago #

    Thanks very much for the feedback. It's a good point, and I've passed it along to the Jetpack developers.

  3. Jeff Bowen
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, Collin:

    The potential library conflicts should be averted as of http://plugins.trac.wordpress.org/changeset/627800

    This will be included in next Jetpack release.

    Thanks again for your report.
    ~Jeff

  4. Collin Donahue-Oponski
    Member
    Posted 1 year ago #

    Hi,

    Thank you so much for tending to this issue.

    I'm a little embarrassed right now -- I might have been thinking incorrectly when I sent this issue over (about how script versions are handled), and I'm afraid I've caused you to make a change that doesn't significantly affect the end result.

    Your changes include:
    - Checking for a pre-registered version of the script before registering your own
    - Changing the priority of your action hook to 120

    The first change is a nice touch. Regarding changing the priority:
    A developer who notices a version conflict can "solve" the problem by enqueuing their version of backbone before jetpack's version. So when you change the priority of your action hook to 120, what you've really done is made it so that, by default, JetPack will defer to someone else's version of backbone. Is that what you want to do? I'm thinking that, if anything, you would want to change the priority to 99 so that only someone who wants to intentially override JetPack's version could do so. At least that way, it's more likely that the conflicting plugin will break instead of JetPack. If the developer even notices, then they will be aware of the potential conflict, they can still find a way around it if needed (enqueue with priority < 99), and they will probably be more careful to test against JetPack in the future.

    Any thoughts? Am I understanding this correctly?

    Thanks again for your time.

  5. Jeff Bowen
    Member
    Plugin Author

    Posted 1 year ago #

    Howdy,
    Since the Notifications feature is primarily a publisher-facing feature (unless someone is showing the toolbar to logged-out users via the 'show_admin_bar' filter), My rationale was: any conflicts will simply cause the Notifications feature to not work (as opposed to breaking the other plugin's functionality).

    Since Backbone.js is included with WordPress core as of 3.5, I'm thinking most plugin devs will have to test against the included version and this won't be an issue.

    Please let me know if you have any further concerns or notice any issues.
    Again, thanks for your note.

    Best,
    ~Jeff

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic