Modify

Opened 3 years ago

Closed 2 years ago

#9873 closed defect (fixed)

jQuery conflict

Reported by: rjollos Owned by: seccanj
Priority: normal Component: ScreenshotPastePlugin
Severity: normal Keywords:
Cc: Trac Release: 0.12

Description (last modified by rjollos)

I'm seeing a jQuery conflict when trying to access the plugin in Firefox 11-beta from Windows 7. I have Trac 0.12.3 running through Apache on CentOS 5. I noticed the plugin is adding jquery-1.5.1.min.js, but Trac includes jQuery so I think plugins are not supposed to include it in a page as well, which might be the source of the problem. I guess this might be okay though because you are using the noconflict calls.

Attachments (2)

jQueryNotDefined.png (128.0 KB) - added by rjollos 3 years ago.
util.py (3.1 KB) - added by seccanj 3 years ago.
Patched util.py

Download all attachments as: .zip

Change History (15)

Changed 3 years ago by rjollos

comment:1 Changed 3 years ago by rjollos

  • Description modified (diff)

Here are some useful resources I found in debugging this issue:

Maybe it would be useful to post these as installation verification and debugging steps on the project page?

comment:2 Changed 3 years ago by rjollos

  • Description modified (diff)

comment:3 Changed 3 years ago by ssimakova

I experience the same problem on WinXP FF3.6.24 and Trac:

System Information
Trac 	0.12
Genshi 	0.6
mod_wsgi 	3.3 
psycopg2 	2.0.14 (dt dec ext pq3)
Python 	2.7.1 (r271:86832, Mar 4 2011, 14:37:24) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
pytz 	2010h
setuptools 	0.6c11
Subversion 	1.6.12 (r955767)
jQuery:	1.4.2

My java is up to date and Supa Demo runs fine.

Any progress in solving this issue?

comment:4 Changed 3 years ago by rjollos

I'd be interested to know if removing the following line from util.py would solve the issue for you:

<script src="%(base_location)s/chrome/screenshotpaste/js/jquery-1.5.1.min.js" type="text/javascript"></script>

Trac 0.12 adds jQuery 1.4.4 to the page, and I'm almost certain that plugins should not add jQuery to the page (though they should add jQuery UI functionality that they want to utilize).

Is there a particular reason you are running FF 3.6.x rather than FF 11 (the latest)?

comment:5 Changed 3 years ago by seccanj

  • Status changed from new to assigned

Hi, sorry for the late answer.

I fixed a similar problem in the TestManagerForTracPlugin, and the fix is to set the jQuery variable along with the $ variable to point to the old jQuery object.

I have attached a patched util.py to this ticket.

Let me know if it works.

Ciao, Roberto

Changed 3 years ago by seccanj

Patched util.py

comment:6 Changed 3 years ago by anonymous

Hello Roberto. I tried the fix and it still does not work. It seems that code on either of lines 52 or 53 is destroying jQuery variable or value, so when code moves along to line 55, error is thrown : 'jQuery is undefined'. Your fix on line 58 is "too late to the party" :) Can you please take a look once more? Thank you!

<script src="%(base_location)s/chrome/screenshotpaste/js/jquery-1.5.1.min.js" type="text/javascript"></script>
<script src="%(base_location)s/chrome/screenshotpaste/js/jquery-ui-1.8.13.custom.min.js" type="text/javascript"></script>
<script type="text/javascript">
var jQuery_screenshotpaste = jQuery.noConflict(true);
jQuery = jQuery_trac_old;
$ = jQuery_trac_old;
jQuery = $;

comment:7 Changed 3 years ago by ssimakova

rjollos, I tried the suggestion to remove the line and it did not help. Problem remains.

comment:8 follow-up: Changed 3 years ago by seccanj

Hi, I assume you only have this conflict using Agilo plugin, right?

I tried the fix and it works in my env. I think the reason may be that I have a working TestManager 1.4.10, which also includes a similar fix for a jQuery conflict.

If you have an older Test Manager, without the fix, then it may be destroying the jQuery variable as you are observing.

Could you try with the latest Test Manager 1.4.10, or if you cannot upgrade, patch your older Test Manager in wiki.py (around line 756) as follows:

        after_jquery = 'var jQuery_testmanager = $.noConflict(true);$ = jQuery_trac_old;jQuery = $;'

Let me know if it works.

Ciao, Roberto

comment:9 in reply to: ↑ 8 Changed 3 years ago by rjollos

Replying to seccanj:

Hi, I assume you only have this conflict using Agilo plugin, right?

I tried the fix and it works in my env. I think the reason may be that I have a working TestManager 1.4.10, which also includes a similar fix for a jQuery conflict.

I was experiencing this issue in a clean install running tracd (I have a script that creates a clean Trac install for development and plugin testing, and only takes about 20 seconds to run, so I can create a new Trac environment for every plugin I test and every ticket that I work on). I'll be able to test out the revised util.py that you posted, but won't have any time to look into it until next weekend, or possible two weekends from now. Just wanted to let you know, I do intend to follow up.

comment:10 Changed 3 years ago by ssimakova

Hi Roberto,

We are not using TestManager at all. Is this a pre-requisite for running ScreenShotPastePlugin?

Thank you

comment:11 Changed 3 years ago by seccanj

Hi ssimakova, no it is not a prerequisite at all.

I said that because I know that rjollos uses it :D

Do you also experience this problem? In case you do, would you describe your running environment?

Ciao, Roberto

comment:12 Changed 3 years ago by ssimakova

Hi Roberto,

i have already described my environment above. Here it is again :

System Information
Trac 	0.12
Genshi 	0.6
mod_wsgi 	3.3 
psycopg2 	2.0.14 (dt dec ext pq3)
Python 	2.7.1 (r271:86832, Mar 4 2011, 14:37:24) [GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
pytz 	2010h
setuptools 	0.6c11
Subversion 	1.6.12 (r955767)
jQuery:	1.4.2

Installed Plugins
AdvancedTicketWorkflowPlugin 	0.11dev-r9962 	
clients 	0.4 	
GnomeBRTheme 	0.1 	
graphviz 	0.7.6dev-r10975 	
NavAdd 	0.1-r11020 	
ScreenshotPaste 	0.1.1 	
STractistics 	0.5.0b 	
ticket-clone 	Rev 	
timingandestimationplugin 	1.2.3b 	
TracAccountManager 	0.3.2 	
TracBurndown 	1.9.2 	
Tracchildtickets 	2.4.5 	
TracMetrixPlugin 	0.1.8 	
TracReportInplaceEditPlugin 	0.1 	
TracThemeEngine 	2.0.1

Java is up to data and SUPA demo runs fine.

comment:13 Changed 2 years ago by seccanj

  • Resolution set to fixed
  • Status changed from assigned to closed

Fixed with 0.1.2.

Get it here!

Add Comment

Modify Ticket

Action
as closed The owner will remain seccanj.
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.