Closed (fixed)
Project:
Syntax Highlighter
Version:
6.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
27 Feb 2009 at 12:07 UTC
Updated:
20 Oct 2009 at 16:55 UTC
Hi — thanks for creating this great module!
Unfortunately it conflicts with the WYSIWYG module's javascript — not sure why. If I remove the following line from the end of my page HTML, this module works perfectly:
<script type="text/javascript" src="/sites/all/modules/wysiwyg/wysiwyg.js?L"></script>
The above is added to my markup via the <?php print $closure ?> in my page.tpl.php.
Something in the wysiwyg module must be breaking yours - I wonder if you could add some js in at the very end after the wysiwyg js, to get yours going again?
Jeff
Comments
Comment #1
jeff h commentedHmm, after more testing, it appears that this is the case only in Safari (tested in OS X, Safari 4 beta). Works fine in Firefox.
Jeff
Comment #2
mattyoung commentedLet me know if you find something to fix here.
Comment #3
mattyoung commentedNo further information received. Mark close.
Comment #4
siromega commentedI have more information as to this issue.
D6.13
WYSIWYG 6.x-2.0 w/ FCKEditor 2.6.4
Syntax Highlighter (the one you gave me from the other bug I filed)
The bug does not happen in FF 3.5, but does occur in IE7, Chrome 2 and Safari 4. One example of where this will break is below..
wysiwyg.js line 195
The issue is that the Syntax Highlighter JS is attaching a method to Array.Prototype (line 1534 of non-minified shCore.js from here). This is interfering with a number of things in the WYSIWYG JS code. In the code above, the for (var i in classes) will return 0...array.length-1 as well as the string "indexOf" because the function has been added to the array prototype. This will occur several places throughout the WYSIWYG code, and possibly in the chosen editor code (in my case, FCKEdtior).
I guess the solution would be to patch Syntax Highlighter JS to remove adding indexOf to the array prototype. No idea how easy/hard that would be though. I will hopefully spend a little time on this today to see what I can get figured out...
Update: I proposed a patch to the Syntax Highlighter JS to move the offending indexOf function from the array prototype to sh.utils.
Comment #5
mattyoung commentedAh, the for(.. in ..) to iterate for array, it will always give you more than you expect.
It's great you got this figure out. This is probably why syntaxhighlighter broke IMCE also.
I'm leaving this as 'active'. Hopefully Alex will fix this in the js library.
Please keep me updated to this issue.
Thanks!
Comment #6
mattyoung commentedAnd have you reported your finding to http://alexgorbatchev.com/forums/?
Comment #7
wgrunberg commented@siromega could you (or anybody else) post a patched version of the syntaxhighlight JS library? I tried applying the proposed patch by hand without success.
Comment #8
wgrunberg commentedThe Syntax Highlighter JS library has been adapted:
http://alexgorbatchev.com/wiki/SyntaxHighlighter:Changes:2.1.364 Issue #63