Closed Bug 285249 Opened 20 years ago Closed 20 years ago

*.style.top is ignored if doctype is set

Categories

(Core :: DOM: CSS Object Model, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED INVALID

People

(Reporter: wenzel.peppmeyer, Unassigned)

Details

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

This simple page shows that *.style.top is ignored when a DOCTYPE is set for
this document. Without any DOCTYPE it works as expected.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>

</head>
<body>
</body>
<script lang="JavaScript 1.2">
	var div=document.createElement("div");
	div.style.position="absolute";
	div.style.top="100";
	div.innerHTML = "foobar";
	document.body.appendChild(div);
</script>
</html>


Reproducible: Always

Steps to Reproduce:
1. add the example in 2 different files.
2. strip the entire <!DOCTYPE ...> statement in one file
3. display both files
4. swear a bit

Actual Results:  
The file with DOCTYPE ignores the div.style.top="100"; line. The file without
doesnt.

Expected Results:  
Move the little div 100px down in both cases.
Wenzel, the example page is in Standards mode which requires units to be
specified for those properties which require them. See
http://www.mozilla.org/docs/web-developer/quirks/ for more information. This is
also not a JavaScript Engine issue but is related to the CSS DOM.
Assignee: general → general
Component: JavaScript Engine → DOM: CSSOM
QA Contact: pschwartau → ian
-> invalid.
Status: UNCONFIRMED → RESOLVED
Closed: 20 years ago
Resolution: --- → INVALID
vrfy. use "100px" instead of "100".
Status: RESOLVED → VERIFIED
Hi, is it worth to send a feature request for raising an exception in a case
like this? That may prevent some stupid question (like mine).
Not really.
1.8 will show a message in JS console like:
Error: Error in parsing value for property 'top'.  Declaration dropped.
Source File: http://www.mozilla.org/products/mozilla1.x/
Line: 0
Raising an exception here would actually violate the CSS specification, so it's
not happening.
You need to log in before you can comment on or make changes to this bug.