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 4 of 4
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts

    Multiple (text) spaces in Moz....

    Does anyone here know how to append whitespace nodes in mozilla without them being 'compressed'? Sampled numerous possibilities including '\u0020' but multiple spaces invariably get crunched down to one (MSIE is cooperative).

  • #2
    Senior Coder
    Join Date
    Jul 2004
    Location
    New Zealand
    Posts
    1,315
    Thanks
    0
    Thanked 2 Times in 2 Posts
    You mean like   ?

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    Compare these, cross-browser:

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" 
        "http://www.w3.org/TR/html4/loose.dtd">
    
    <html>
    <head>
    <title>untitled</title>
    </head>
    <body>
    <div id="x1"></div>
    <div id="x2"></div>
    <div id="x3"></div>
    <script type="text/javascript">
    var spaces = '\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020\u0020';
    document.getElementById('x1').appendChild(document.createTextNode('#' + spaces + '#'));
    var spaces = '          ';
    document.getElementById('x2').appendChild(document.createTextNode('#' + spaces + '#'));
    var spaces = '#          #';
    document.getElementById('x3').appendChild(document.createTextNode(' ')).data = spaces;
    </script>
    </body>
    </html>

  • #4
    Senior Coder
    Join Date
    Jun 2002
    Posts
    1,404
    Thanks
    2
    Thanked 32 Times in 32 Posts
    OK, found it. God Bless everyone.


  •  

    Posting Permissions

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