.innerHTML bug with mozilla/firefox (Ajax)

C

Clément

Hi!

I am currently developping a user interface with Ajax/C#/.net. And I am
facing a problem with Mozilla, and Firefox.

I use the function innerHTML to load a Web UserControl into a div, this
way the main page never gets refreshed. It works perfectly under IE,
but with Mozilla and Firefox I got a problem : there is a space before
the thing I want to display everytime I use ".innerHTML".

For example:

I have a div called "test" like ...
=> "something"
When I use test.innerHTML = "something else", I get ...
=> "
something else"


Could someone help me, please?
 
T

Thomas 'PointedEars' Lahn

Clément said:
I have a div called "test" like ...
=> "something"
When I use test.innerHTML = "something else", I get ...
=> "
something else"
[...]

Why, `div' elements are block-level elements by default. So they may have
a (top) margin, and the parent block-level element may have a (top) padding.
If you do not want the padding or the margin (as defined in the basic
stylesheet), you have to set it to 0, using CSS.

That there is a padding or a margin is no bug at all.


PointedEars
 
C

Clément

All the margin and padding values are set to 0px.
And actually, everytime I execute the function, the display change!
so it is like ...

original page
=> "something"
test.innerHTML = "something else"
=> "
something else"
test.innerHTML = "something else"
=> "

something else"
test.innerHTML = "something else"
=> "


something else"


I cheked the code in the innerHTML, with the function alert.
And there is another problem.
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
....
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.
 
T

Thomas 'PointedEars' Lahn

Clément said:
All the margin and padding values are set to 0px.
And actually, everytime I execute the function, the display change!
so it is like ...

original page
=> "something"
test.innerHTML = "something else"
=> "
something else"
test.innerHTML = "something else"
=> "

something else"
test.innerHTML = "something else"
=> "


something else"

Weird. But .innerHTML is proprietary, so one should not expect consistent
results.
I cheked the code in the innerHTML, with the function alert.
And there is another problem.
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
...
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.

The are dozens of versions of Mozilla (Seamonkey) and Netscape (Navigator).
None of my innerHTML-capable Mozilla browsers[1] does show such a behavior.
Which ones have you tested with (Help, About)?

The code you posted is insufficient for problem analysis. Please post the
public URL of a test case. (Maybe in creating that test case, you will
find the problem yourself.)

Please quote what you are replying to, as customary on Usenet.[2][3]


PointedEars
___________
[1] Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205
Debian/1.7.12-1.1

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805
Netscape/7.2

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3

[2] <URL:http://www.safalra.com/special/googlegroupsreply/>

[3] <URL:http://jibbering.com/faq/faq_notes/pots1.html>
news:[email protected]
 
T

Thomas 'PointedEars' Lahn

Thomas said:
Clément said:
[...]
In fact, when I do :
test.innerHTML =
'<div><table><tr><td>something</td></tr></table></div>'
The result is weird, because I check the code with an alert and I get
...
alert(test.innerHTML);
=>'<div></div><table><tr><td>something</td></tr></table>'

Why does Mozilla do that?? Apparently, Netscape does the same.

[...]
None of my innerHTML-capable Mozilla browsers[1] does show such a
behavior. [...]
___________
[1] Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.12) Gecko/20060205
Debian/1.7.12-1.1

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.2) Gecko/20040805
Netscape/7.2

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:0.9.4.1) Gecko/20020508
Netscape6/6.2.3

I forgot

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.0.1) Gecko/20060313
Debian/1.5.dfsg+1.5.0.1-4 Firefox/1.5.0.1


PointedEars
 
C

Clément

The are dozens of versions of Mozilla (Seamonkey) and Netscape (Navigator).
None of my innerHTML-capable Mozilla browsers[1] does show such a behavior.
Which ones have you tested with (Help, About)?

This is the version of Mozilla/Firefox I am using ...
Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.8.0.1)
Gecko/20060111 Firefox/1.5.0.1

The code you posted is insufficient for problem analysis. Please post the
public URL of a test case. (Maybe in creating that test case, you will
find the problem yourself.)

I can't create a test case on a public URL because I am developping
this application with C# / .net, and servers for it are not free!
Moreover, I don't have the right to do it vis-a-vis of my company.

But to explain you a little more, I have a main page in which I have 3
div. I load web user controls dynamically (with ajax) in one of them.
The code generated by the WUC, which contains another div that contains
other things (this way <div><table> ... </table></div>), is put in the
div with the function .innerHTML. And as I told you, with IE it works
perfectly, but with Mozilla/Firefox and Netscape the code into the
div.innerHTML is changed like "<div></div><table>...</table>".
 
C

Clément

I found a solution!
It is really weird...

In fact I was using an asp:panel in my aspx page, that was replaced in
the navigator by a DIV, which is normal, but that DIV had this strange
behavior I explained.
I really don't know why! But by replacing this asp:panel by a standard
DIV, the problems disappear!!!

Thanks anyway for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,044
Latest member
RonaldNen

Latest Threads

Top