Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post

    innerHTML problem in Mozilla with split()

    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):


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

    <br />
    D<br /><br />
    E
    </p>


    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 I submitted).

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

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    near Oswestry
    Posts
    4,508
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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 - Cleaning useless whitespace in Mozilla DOM
    "Why bother with accessibility? ... Because deep down you know that the web is attractive to people who aren't exactly like you." - Joe Clark


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •