Closed
Bug 223608
Opened 22 years ago
Closed 22 years ago
JavaScrypt document.body.scrollLeft always=0 whith XML doctype
Categories
(Core :: DOM: Core & HTML, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: kamor, Unassigned)
Details
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.5) Gecko/20031007
document.body.scrollLeft and document.body.scrollTop are stuck to 0 when i try
to read them when my doctype is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
or 1.0 ...
If i set this doctype
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
or no doctype,
the javascript works.
This bug wasn't present in Mozilla 1.4 i guess.
------ code to test ----
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="fr" xml:lang="en">
<head>
<script type="text/javascript">
<!--//
function test(){
alert('scrollLeft='+document.body.scrollLeft+', body='+document.body);
}
-->
</script>
<title>Test</title>
</head>
<body>
<div style="height:10px;width:2000px;background-color:pink">
<form method="post" action="javascript:test()"
enctype="multipart/form-data">
<p>Test JavaScript
<input name="Test" value="Test" type="submit"/>
</p>
</form>
</div>
</body>
</html>
Reproducible: Always
Steps to Reproduce:
1.Save test code in an html file.
2.Open it with Mozilla
3.Click the button while the bottom scrollbar is scrolled
Actual Results:
alert box with scroll=0.
Expected Results:
scroll should change according to the scrollbar position
Comment 1•22 years ago
|
||
This is correct. The <body> is in fact not scrolling -- the viewport is. In
quirks mode, we map the viewport's scroll position to the <body> for
compatibility with IE and old scripts. But if you page has a recent doctype, we
go into standards mode.
Status: UNCONFIRMED → RESOLVED
Closed: 22 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•