473,383 Members | 1,803 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,383 software developers and data experts.

Safari DOM not resetting when layer changed

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?

Thanks in advance for any help!

Tim

Jul 23 '05 #1
1 1625
ti******@gmail.com wrote:
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?


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
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: liberty | last post by:
Hi, I have looked everywhere to try and solve my problem-- looked at W3C DOM Compatibility charts, read articles, tried debuggers, and still my script is not working. The problem I have is this. ...
4
by: Pasquale | last post by:
With the code below, can anyone see why the array and/or the field in the last line are empty for Safari users? It works with Netscape 6 and up, IE 6, Firefox, Konqueror. Thanks, Pasquale ...
2
by: Lau Lei Cheong | last post by:
This is to be refered to my many-months-ago previous most on "mercyful browers". It just seems that both IE and Firefox are "too merciful" to web development testing. There's a sample code to...
5
by: jmdocherty | last post by:
All, I've been trying to set up a CSS layout and all seems well in Firefox but in Safari it just seems to be plain weird! I hope someone can help tell me whether this is a problem with my code...
4
by: Ian Davies | last post by:
Hello I am struggling for a solution to clear some fields on my webpage that takes their values from some sessions My solution below works when the button is clicked twice. I sort of know why I...
12
by: effendi | last post by:
I wrote the following function and tested it in MSIE, Firefox and Mac Safari, Works in all but the Safari. What can I do to rectify this? function processBackground(){ for (n=1;n<11;n++) { ...
11
by: J_Zanetti | last post by:
Hello everybody, In my applications I've a ton of scripts that use remote XML file to fill forms and evaluate contents; In these scripts I always use the method SelectNode (that, with some...
3
by: dd | last post by:
Hi, I have some code that hides all Flash objects on a page. It's working fine on IE and Gecko but doesn't work on Safari. There are no errors (shown in the console) when it runs on Safari, and...
2
by: JDeats | last post by:
>From my development envrionment (i.e. a single WinXP notebook PC) I have a basic AJAX application that is making the call to a Windows Form page that just returns the request back to the AJAX...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.