Bug 134632 - [test case]Rendering fails when inserting in innerHTML a string after that an empty string was inserted in a table cell
Summary: [test case]Rendering fails when inserting in innerHTML a string after that an...
Status: RESOLVED WORKSFORME
Alias: None
Product: konqueror
Classification: Applications
Component: khtml (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-09-25 15:44 UTC by Enrico Oltolina
Modified: 2008-04-25 08:59 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
test case attached (1.49 KB, text/html)
2006-09-25 16:07 UTC, Tommi Tervo
Details
Reduced testcase (1.06 KB, text/html)
2007-01-24 16:09 UTC, Luciano Montanaro
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Enrico Oltolina 2006-09-25 15:44:37 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    SuSE RPMs
OS:                Linux

Insert an empty string in innerHTML of a table cell.
After that, try to insert a string in the same cell: it does not work!
If you try again, the string is correctly inserted.
In attachment an example html page: click on "GO RIGHT", the string "Informazioni al momento non disponibili" is replaced with an empty string. Correct!
Now click on GO LEFT. Expected: the empty string is going to be replaced with "Informazioni al momento non disponibili".
Wrong! You have to click a second time.
The page works as expected with firefox or internet explorer.
I looked the code, I think that the problem is in htmltokenizer.cpp or in htmlparser.cpp. Infact, if checking the HTMLElementImpl::setInnerHtml, the fragment created does not have children when the string is empty, so the rect is not repainted.
Now the example:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
	
	<script type="text/javascript" language="JavaScript">

	var programDescObj = null;

	function init() {
		programDescObj=document.getElementById("programDesc");
		updateEventGraphic();
	}
	
	function updateEventGraphic(arg) {
		if (arg == "right") {
			programDescObj.innerHTML = "";
		} else {
			programDescObj.innerHTML = "Informazioni al momento non disponibili";
		}
	}

	</script>
	
	<style type="text/css">

	#programInfoDesc{position:absolute;left:93px;top:374px;z-index:2;width:445px;height:117px;visibility:visible;}

	.nero16cont {color:#000000;padding-left:5px;padding-right:5px;line-height:23px;}
	</style>
</head>

<body onload="init()" >

<!-- ++++++++++ programInfoDesc +++++++++++++ -->
<div id="programInfoDesc" class="programInfoDescTop1">
<table cellspacing="0" cellpadding="0" border="0">
	<tr>
		<td id="programDesc" width="445" height="118" valign="top" class="nero16cont"></td>
	</tr>
</table>
</div>

<div style="position:absolute;top:200px;left:40px;">
<a id="0-0" href="javascript:updateEventGraphic('left')" fwleft="1-1" fwright="1-1">GO LEFT</a>&nbsp;&nbsp;
<a id="1-1" href="javascript:updateEventGraphic('right')" fwleft="0-0" fwright="0-0">GO RIGHT</a>
</div>

</body>
</html>
Comment 1 Tommi Tervo 2006-09-25 16:07:08 UTC
Created attachment 17911 [details]
test case attached
Comment 2 Tommi Tervo 2006-09-25 16:08:35 UTC
confirmed, svn r583k
Comment 3 Luciano Montanaro 2007-01-24 16:08:07 UTC
Tested again with kdelibs r626611.

Actually, it is not necessary to click on "GO LEFT" to show the hidden text.
Even a click on the page in any place under which the div is supposed to go seems to trigger a refresh of the hidden area.

I have reduced the testcase a bit more, and the required condition to see the bug is that the <td> must contain the width attribute.
Comment 4 Luciano Montanaro 2007-01-24 16:09:57 UTC
Created attachment 19396 [details]
Reduced testcase

This is a reduced testcase still showing the bug.
Comment 5 Frank Reininghaus 2008-04-24 18:58:01 UTC
Bug appears to be fixed in SVN trunk rev. 798811. Can still be reproduced in 3.5.9.
Comment 6 James Spahlinger 2008-04-25 08:59:10 UTC
closing as its resolved in 4.0.3