Help Desk

debug.{anything} but debug.info is not a function

  • Posts: 7 Topics: 2
    | Permalink

    I’m getting the debug.info is not a function javascript error. This is causing certain parts of the calendar to fail (date picker, list/mont/day picker, etc.). When I clear all debug.{whatever} (all debugging) from the non-minified file tribe-events.js and rename that file to .min, all works well.

    The file tribe-events.js says that the debug blocks are removed in the minified versions. They are not.

    In order to get the debug.{whatever} to work and not break the javascript on the plugin, I need to copy the
    window.debug = (function() { … })
    function to my footer file. This however, causes certain things to print out on the page with some of the ad javascript being used.

    There should be no debugging happening in the .min and on the live usage of the plugin. I would like to use the plugin, and we have payed for the pro version, what do you suggest as a solution for this?

    I have not deactivated all other plugins to see if there is a conflict because I know the source of the problem and there should be no debugging on your end with the final minified version, not unless conditioned to print only if the global variable is set to true (which it is by default it seems). If there was a parameter in the settings for js debugging (not just debugging to a file), and all of the debugging was active only under that condition, then the debug scripts could stay, along with the window.debug = (function() { … }) function code to allow the use of the debug.{whatever}.

    Also (FYI), I am getting this warning in firefox:
    Using //@ to indicate sourceURL pragmas is deprecated. Use //# instead

    Posts: 6680 Topics: 2
    | Permalink

    Hello there,

    Thanks for going Pro and welcome to our Help Desk!

    I’m sorry to hear you are having issues on your website. Let’s see what we can do.

    I see you are using caching / CDN. We are aware that sometimes there are issues when the calendar resources (js, css, etc.) are minified. So as a first step I would recommend to exclude these from minification.

    Probably the best way to go about this is to disable minification in general and check if the site works properly like that. If it does, then start minifying other resources.

    Let me know how that plays out. If there are still issues with no minification, then we can dig further.

    Cheers,
    Andras

    Posts: 7 Topics: 2
    | Permalink

    There is no minification occurring on the site. Yes, we are using a CDN, but the files are not minified. The caching is happening from the server and it has been cleared numerous times while I was debugging the issue. Have you read my ticket? The problem is the javascript debug object! The debugging is scattered throughout your javascript files!

    The code that controls that debug call is omitted in the minified version however the debug object is still being used throughout. That is causing the error!!!!!

    In the unminified version (THE PLUGIN IS USING THE MINIFIED VERSION, as it should be) even states it:

    ======================
    /*!
    * this debug code is stripped out by closure compiler so it is not present in the .min versions.
    */

    // @ifdef DEBUG

    /*!
    * JavaScript Debug – v0.4 – 6/22/2010
    * http://benalman.com/projects/javascript-debug-console-log/
    *
    * Copyright (c) 2010 “Cowboy” Ben Alman
    * Dual licensed under the MIT and GPL licenses.
    * http://benalman.com/about/license/
    *
    * With lots of help from Paul Irish!
    * http://paulirish.com/

    */

    That function is included in the unminified javascript file, but is removed in the minified version, however you STILL have the “debug” object being called throughout, with no reference to the object. It’s properties (or members) such as debug.info, are NOT DEFINED!!!!

    Do you understand what I am saying? This needs to be fixed. There should be no debugging in the release version of the files (the minified versions).

    Posts: 7 Topics: 2
    | Permalink

    If you decide to take a look at the site, things will be working on the events page. This is BECAUSE I have just now added the function for debugging in the footer for that page.

    Posts: 7 Topics: 2
    | Permalink

    Ok, I have to ammend my statements. I am looking at the minified version right now and the function is included:

    ;window.debug=function(){function e(e){!r||!a&&s&&s.log||r.apply(i,e)}function t(e){return d>0?d>e:l.length+d<=e}for(var r,a,i=this,n=Array.prototype.slice,s=i.console,o={},d=9,l=["error","warn","info","debug","log"],u="assert clear count dir dirxml exception group groupCollapsed groupEnd profile profileEnd table time timeEnd trace".split(" ")…

    But for some reason, it is not being recognized on my site. We are using ads and it is possible that they are also using the window.debug function but in an altered way. I am not sure. When I add the function, unminified, to the footer, it works well for the events calendar but it causes the ads to some weird printing out of what looks to be debug info. So, it is likely that they are also using the same function from the same open source as you, but they have modified it and redefined the debug object. This still falls on you as plugin developers. You have a WordPress Plugin. It will be expected to work well with countless other plugins and code for countless other sources. Because of this, you should not be using the generic open source object variable of "debug"…. It should be called tribedebug or something. It's a VERY simple fix to sort of namespace the variable so that you do not run into conflict with very likely possibility that someone else is using the same popular open source script.

    So, for me right now, I am left with only a few options. 1) to change your code directly and keep a copy so that I can replace the files everytime you submit an update. 2) try to get the ad companies to namespace the debug object they are using from the same source (which is never going to happen). 3) sit and wait for you guys to do something about this and namespace YOUR debug object (I do not know how motivated you guys are to doing this). 4) create a bunch of javascript hacks that not only redefine the debug object to it's original condition, but to look for the output from the ad companies in the DOM and remove them. 5) edit all of your javascript files and remove the debugging or namespace the debug object myself, and then try to dequeue the plugin scripts and call them myself, referencing the working, edited files in an attempt to avoid having to make changes everytime you put out an update.

    Posts: 7 Topics: 2
    | Permalink

    I just did some debugging on staging and the conflict is with the javascript used by the freestar ad company. I will get in touch with them, but it seems you are both using the open source library to use the debug object, without namespacing it, and therefore conflicts are inevitable.

    Will you change your code to namespace the debug object/function variable?

    Posts: 7 Topics: 2
    | Permalink

    The ad company responded and yes, they are using the debug variable although in a different way. So you see, using such a generic variable is conflict prone. Just doesn’t make sense to name something globally like that. You should namespace it. Will you do this?

    Posts: 6680 Topics: 2
    | Permalink

    Hi again,

    Thanks for getting back to me with all the details above. Much appreciated! That gives a clearer picture of what is happening here.

    I will check what we can do about this or if we can suggest a workaround. Will get back to you soon.

    Cheers,
    Andras

    Posts: 7 Topics: 2
    | Permalink

    Hey guys, any update on this matter?

    Posts: 6680 Topics: 2
    | Permalink

    Hi gardeningknowhow,

    I have discussed this with a developer and have opened an internal bugticket for this. We will try to look into this to get a solution out with our next maintenance release (end March-ish). I cannot guarantee it will be done by then but we see how this can cause issues and we will definitely handle it.

    I am going to set the status of this ticket to “pending fix” and we will update it once the fix is released.

    If you have any new questions or issues please create a new ticket and we’ll help you out.

    Thanks and cheers,
    Andras

This thread hasn’t seen any activity for quite some time and we are not accepting further replies.

If you need further help with this or any other issue, please create a new topic (you can of course include a link to this one if that helps to provide additional context) and one of the team will be only too happy to help.