Giter Site home page Giter Site logo

Comments (20)

ztane avatar ztane commented on June 29, 2024

Sorry, $.noConflict(true) was called :) So only 2) applies. To further elaborate, we do not notice any issues in Firefox, but with Chrome, the ondomready functions most of time see the wrong window.$ variable, which is missing our jQuery plugins.

from pyramid_debugtoolbar.

mcdonc avatar mcdonc commented on June 29, 2024

Do you think you can supply a patch that gets rid of the symptom?

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

can you checkout latest changes and tell me if it's fixed?

from pyramid_debugtoolbar.

ztane avatar ztane commented on June 29, 2024

I am not sure if this is enough, the problem was that our $() handlers could fire between any two scripts that are injected to document.body. We can use closures but many other ppl will have needless hours debugging.

Furthermore, fresh checkout caused random infernal server errors ;)

from pyramid_debugtoolbar.

ztane avatar ztane commented on June 29, 2024

The 500 error reported here #41.

After fixing that, saw yet another race cond, this time "$(".pDebugSortable").tablesorter" is not a function.

I am leaning towards a solution where both the jquery AND tablesorter.js would be patched by hand to use a variable name like pyramid_debugtoolbar_jquery instead of $ :D It seems to be the only way to avoid such race conditions.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

Have you flushed you cache? jQuery is now called as jq from the script and will not work properly if used with the previous way.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

Actually var jq = jQuery.noConflict(true); and we use closure and reference jq as $. So it's sets our jQuery to jq and restore any previous loaded jQuery to $ so you shouldn't have problem with your own scripts. Be sure to clear up your cache or you'll definitely have problem with table sorter and the debugger.

I can see you got server errors because of the bad join list, however if you got random error I would like to see your tracebacks to know where the problem is.

from pyramid_debugtoolbar.

ztane avatar ztane commented on June 29, 2024

the problem is that ondomready can be fired between any two consecutive script loads for script elements document body. The closure in place "x" does not help, because ondomready can fire after jquery-1.6.4.min.js is loaded and before tablesorter, OR after tablesorter is loaded but before the noconflict line is run. With Chrome, one can read "can fire" as "most probably fires."

I would say that there are only 3 possible fixes

  1. Do use the jquery that is already linked on the page, and hope it works, and that tablesorter does not clash with anything else
  2. or catenate all scripts together and make a closure around them
  3. rename the jQuery and $ variables to something else INSIDE jquery.js and use them everywhere.

All three options mean the jquery source has to be hacked - one way, or another.

I think 2 could be the cleanest option. I can post a patch when we have our release out of hands.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

A cleaner solution wouldn't be to go with require.js then?

from pyramid_debugtoolbar.

jayd3e avatar jayd3e commented on June 29, 2024

I just received this error 'Uncaught TypeError: Property '$' of object [object DOMWindow] is not a function' while using the Debug Toolbar, and removing the toolbar fixed the error. I think it is related to this issue. Debug toolbar is still overwriting '$' somewhere.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

Are you using the latest toolbar release? On what browser and os you get the error?

from pyramid_debugtoolbar.

jayd3e avatar jayd3e commented on June 29, 2024

I'm using the latest release, and I'm on Mac OSX Lion on Chrome v19.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

Can you replicate the behaviour in a sample app and share it?

from pyramid_debugtoolbar.

jayd3e avatar jayd3e commented on June 29, 2024

That might be difficult, because it was working before my project reached a certain size. I'm sure load times factor into this in some way. I'll definitely try though.

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

if you app is becoming large, js speaking, you could benefit using requires to modularize and load your code.

from pyramid_debugtoolbar.

jayd3e avatar jayd3e commented on June 29, 2024

I checked it out, didn't really like it. I use the module system detailed here.

from pyramid_debugtoolbar.

AaronAsAChimp avatar AaronAsAChimp commented on June 29, 2024

This error still occurs in v1.0.4. The version of jquery included with the toolbar uses the global define rather than pyramid_debugtoolbar_define. This causes it to load in the app's requirejs and overwriting its version of jquery.

Wrapping the library like so will fix it:

define = pyramid_debugtoolbar_define;
/*! jQuery v1.7.2 jquery.com | jquery.org/license */
/* ... */
define = pyramid_debugtoolbar_std_define;

from pyramid_debugtoolbar.

blaflamme avatar blaflamme commented on June 29, 2024

Can you fix it, test it and send a pull request?

from pyramid_debugtoolbar.

rclmenezes avatar rclmenezes commented on June 29, 2024

I discovered a similar issue using v1.0.6 when doing browser compatibility testing in IE. I was having this infuriating error where a jQuery plugin I wrote would only work three quarters of the time and the other fourth of the time be undefined. After digging around for a couple hours, I discovered that my jQuery plugin was extending my version of jQuery while the code on the page was running the jQuery used by pyramid_debugtoolbars!

I'm not entirely sure what caused this kind of behavior (the IE gods are fickle) and it's difficult to replicate regularly. I have my version of jQuery and my plugin both running in the page's , so I think I'm doing it correctly...

Any ideas?

from pyramid_debugtoolbar.

mmerickel avatar mmerickel commented on June 29, 2024

This issue is no longer relevant as the toolbar is hosted in a separate tab now.

from pyramid_debugtoolbar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.