#277 bug
Cyberdust

Element.update(), innerHTML and white spaces with IE

Reported by Cyberdust | August 13th, 2008 @ 01:24 PM

Hello

I found out that using Element.update() with an element wich have a white-space CSS property set to pre IE6 and IE7 strip formatting white spaces the pre setting is meant to keep.

with the followig function defined :


   function testPre() {
        $('somePre').update('another Test        with     lot    of     spaces');
   }

and an HTML page such as this one :


    <button type="button" onclick="testPre();">Change</button>
    <pre id="somePre">test      with    a   bunch   of     spaces<pre>

When loading the page we can see every spaces in the <pre> tag But when we click on the button, the string is striped of all extra-spaces on IE6 and IE7

This is due to the use of innerHTML to update the element content

I managed to get around this problem using :


    $('somePre').appendChild(document.createTextNode((someStringWithSpaces));

That's why this ticket is related to Ticket#212

So this problem may need some changes in order to give less reliability to the innerHTML property and more to the DOM way of updating elements.

Thanks for the very usefull tools ;)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

The Prototype JavaScript library.

Shared Ticket Bins

Pages