View Full Version : innerHTML problem in Mozilla with split()

03-16-2004, 06:58 PM
In Mozilla, whitespace and line breaks are shown in the innerHTML (try alerting and you'll see). On my forum, I'm making a mod that must split up HTML tags in a certain way (the forum source is beyong my control):

A<br /><br />
B<br /><br />
C<br />

<br />
D<br /><br />

Note the space between the pair of <br /> tags between C and D. IE will split all of these without a problem, but Mozilla can't. (see Bug 237330 (http://bugzilla.mozilla.org/show_bug.cgi?id=237330) I submitted).

Is there a regular expression that can handle this? You can use regular expressions in split() too right?

03-17-2004, 01:28 AM
That bug is marked RESOLVED - WONTFIX. That's because it's the author's responsibility to deal with whitespace, not the browser's.

Anyway Alex wrote a method for cleaning whitespace that should solve your problem - http://www.codingforums.com/showthread.php?s=&threadid=7028