timchalk@gmail.com wrote:[color=blue]
> I believe I've found a problem with the Safari DOM when updating the
> text found within a layer. Although the layer is updated correctly
> visually, the underlying DOM seems to grow larger with duplicated
> elements rather than being reset with the new elements. I've created a
> test page which demonstrates this issue...
>
>
http://www.qas.com/layer-test.htm
>
> The page contains an initially empty <div> element within <form> tags.
> When the page loads the div is populated with an input field and a
> button using Dreamweaver's MM_setTextOfLayer function. The action on
> the button is to update the div with some new form elements and alert
> the form collection. The updated div contains a button which sets the
> div back to its original state and again alerts the form collection.
> This does exactly what you expect in IE, Firefox, NS6+, Opera, with
> just the form elements visible on the page being alerted, but in Safari
> the form collection just keeps growing as you move back and forth using
> the buttons.
>
> Is there another way to do this in Safari or is a bug with the program?[/color]
I'd like to blame that dreadful MM_ code, or innerHTML, but it is a
bug with Safari that removed form elements aren't really removed.
<URL:http://www.quirksmode.org/bugreports/archives/2004/11/safari_and_docu.html>
other Safari bugs are listed at Quirksmode here:
<URL:http://www.quirksmode.org/bugreports/archives/safari/>
Here's a simple test script:
<form action="">
<input type="text" name="num" width="30"><br>
<input type="button" value="Add a button" onclick="
var oInp = document.createElement('input');
oInp.type = 'button';
oInp.value = 'Delete me';
oInp.onclick = function() {
this.form.removeChild(this);
}
this.form.appendChild(oInp);
this.form.num.value='There are '
+ this.form.elements.length + ' elements';
">
</form>
I'd suggest re-writing that awful MM_ stuff to be cleaner and leaner
and replace innerHTML with DOM.
Get rid of the " /* <![CDATA[ */ " comment delimiters inside the
script element - your doctype is HTML and therefore they aren't
required at all. Similarly, the use of " />" indicates XHTML, but
your doctype is HTML.
--
Rob