Closed
Bug 22249
Opened 26 years ago
Closed 26 years ago
JavaScript cannot find css attributes when defined globally in <style> tag
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
VERIFIED
INVALID
People
(Reporter: dan, Assigned: vidur)
References
()
Details
If you have the following element defined:
<style type="text/css">
#mylayerDiv {position:absolute; left:250px; top:50px;}
</style>
<div id="mylayerDiv">mylayerDiv</div>
The element will *display* properly but if a JavaScript tries to access the left
property with this:
var m = document.getElementById("mylayerDiv")
alert(m.style.left)
You get a blank value, no result, nothing.
This is a serious enough bug that makes it extremely difficult to make a
JavaScript even semi-compatible between Netscape 4 and Mozilla.
This was on Linux Mozilla nightly build as of Dec 12.
| Assignee | ||
Updated•26 years ago
|
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → INVALID
| Assignee | ||
Comment 1•26 years ago
|
||
According to DOM Level 2, the style property of elements reflects the *inline
STYLE attribute* of the element and not the computed style. You'll find that
you'll get the same results in IE. DOM Level 2 does define a way to get the
computed style, but it won't be implemented until post Beta 1.
You need to log in
before you can comment on or make changes to this bug.
Description
•