Closed Bug 218939 Opened 21 years ago Closed 21 years ago

compounding whitespace generated when toddling the element.style.display between 'block' and 'none'

Categories

(Core :: DOM: Core & HTML, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 97506

People

(Reporter: bugzilla.mozilla.org, Unassigned)

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.4) Gecko/20030529

When using Javascript to toggle the style.display property of an element between
the values 'block' and 'none' when the element is set to none and back to block
the element is rendered improperly.  Further toggling between the two states
generates compounding whitespace with each successive toggle of the property to
block.

Reproducible: Always

Steps to Reproduce:
1. create a page with the following code...


<script language="JavaScript" type="text/JavaScript">
	function toggle(id) {
		var el = document.getElementById(id).style;
		if (el.display=="none"){
			el.display='block';
		}else{
			el.display='none';
		};
	};
</script>

<table border="1" cellpadding="4" cellspacing="0" bgcolor="#FF0000">
    <tr>
	   <td>Row 1
    <tr onClick='toggle("Submenu");'>
	   <td>Row 2
    <tr id='Submenu'>
	   <td>
	   <td>
			<table border="1" cellpadding="0" cellspacing="0" bgcolor="#00FF00">
			    <tr>
				   <td>Row 1
			    <tr>
				   <td>Row 2
			</table>
    <tr onClick='toggle("menu");' >
	   <td>Row 3
    <tr id='menu'>
	   <td>Row 4
    <tr>
	   <td>Row 5
</table>


2. open page in browser

3. click on rows 2 or 3 repeatidly
Actual Results:  
extraneous whitespace is created and the element being rerendered

Expected Results:  
rendered the element properly without extra whitespace.
Similar to bug 217714
Assignee: dom_bugs → block-and-inline
Status: UNCONFIRMED → NEW
Component: DOM HTML → Layout: Block & Inline
Ever confirmed: true
Keywords: testcase
OS: Windows 2000 → All
Summary: compounding whitespace generated when toddling the element.style.display between 'block' and 'none' → compounding whitespace generated when toggling the element.style.display between 'block' and 'none'
The display value a table row should have is 'table-row', not 'block'.  When you
make it 'block', we have to create anonymous table layout objects per the CSS spec.

That said, the space should not be growing; it should be a single set size.  
Bug 97506 covers this issue, basically.

*** This bug has been marked as a duplicate of 97506 ***

*** This bug has been marked as a duplicate of 97506 ***
Status: NEW → RESOLVED
Closed: 21 years ago
Component: Layout: Block & Inline → DOM HTML
Keywords: testcase
OS: All → Windows 2000
Resolution: --- → DUPLICATE
Summary: compounding whitespace generated when toggling the element.style.display between 'block' and 'none' → compounding whitespace generated when toddling the element.style.display between 'block' and 'none'
Component: DOM: HTML → DOM: Core & HTML
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: