Open GoogleCodeExporter opened 8 years ago
Here's an updated version of the patch, that fixes a IE problem with white space
handling.
Original comment by rafaelst...@gmail.com
on 2 Sep 2007 at 5:40
Attachments:
Well, well, well.. After playing with it under IE6, IE7, Safari 2 and Firefox
2, it
appears that all this mess can simply be fixed by just replacing the original
call to
str = str.replace(/ /g, ' ');
by
str = str.replace(/ /g, ' ');
Much simpler :D.
Original comment by rafaelst...@gmail.com
on 10 Sep 2007 at 1:54
Hi, using the str.replace method seemed to work really well at first sight but
I just
noticed a problem. In IE some important whitespaces between keywords and
following
chars gets lost! I noticed this in a javascript block where:
var varName
became
varvarName
I've now noticed this happening in both js and html blocks
I'm going to try the original solution and see how well that works :D
Original comment by ccodl...@gmail.com
on 15 Feb 2008 at 7:32
Ok, both solutions seem to have the same issue in IE! Works well in FF, Safari
and Opera.
Example here: http://www.webdesignpro.co.uk/example.php
Original comment by ccodl...@gmail.com
on 16 Feb 2008 at 2:48
My solution:
first replace
str = str.replace(/ /g, ' ');
with
str = str.replace(/ /g, ' ');
This solves the issue of word wrapping but creates 2 spaces in every place that
there
should be one. To overcome this I loop through all the code divs and replace the
double spaces with single ones, I do this after the highlighter script has been
called:
var r = document.getElementsByTagName('div');
for (var i=0; i<r.length; i++) {
if (r[i].className=='dp-highlighter'){
r[i].innerHTML = r[i].innerHTML.replace(/ /g, ' ');
}
}
This fixes things in FF and IE but for some reason the double spaces remain in
Opera
and Safari(pc). Best solution I can find though.
Hope this helps someone :)
* note. The issues I've mentioned in the last few post have all been related to
implementing syntax highlighter with textareas not pres.
Original comment by ccodl...@gmail.com
on 16 Feb 2008 at 5:52
[deleted comment]
Have you guys came up with a full fix yet or decided on something else?
Original comment by alex.gor...@gmail.com
on 9 Oct 2008 at 1:25
Original issue reported on code.google.com by
rafaelst...@gmail.com
on 27 Aug 2007 at 3:44Attachments: