Closed Bug 479698 Opened 17 years ago Closed 17 years ago

document.defaultView.getComputedStyle doesn't return correct 'border-' properties

Categories

(Firefox :: General, defect)

x86
Windows XP
defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 137688

People

(Reporter: laisznertamas, Unassigned)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; hu; rv:1.9.0.6) Gecko/2009011913 Firefox/3.0.6 The document.defaultView.getComputedStyle method doesn't return correct data when I try to get properies of the complete border of an element. For exemple: document.defaultView.getComputedStyle(element, null).getPropertyValue('border-left-color'); THIS WORKS LIKE SHOULD document.defaultView.getComputedStyle(element, null).getPropertyValue('border-color'); PROBLEM!!! IT RETURNS ONLY AN EMPTY STRING! Reproducible: Always Steps to Reproduce: Try to get the value of the 'border-color' property of an element with document.defaultView.getComputedStyle! Actual Results: It returned an empty string. Plese note that I had set this property in the head of the HTML document. The code: --------- <style type="text/css"> border-color: rgb(20, 20, 20); border-style: solid; color: rgb(255, 255, 255); margin-bottom: 60px; background-color: rgb(80, 80, 80); </style> <!-- ... --> <div id="mydiv">test div</div> <script language="javascript" type="text/javascript"> function getStyle(element, property) { if (typeof(element) == 'string') element = document.getElementById(element); return document.defaultView.getComputedStyle(element, null).getPropertyValue(property); /* !!! TEST CODE !!! */ alert(getStyle('my_div', 'background-color')); // OK!!! alert(getStyle('my_div', 'border-color')); // :-( </script>
I'm sorry, of course, the code is wrong, the correct style: <style type="text/css"> #mydiv{ border-color: rgb(20, 20, 20); border-style: solid; color: rgb(255, 255, 255); margin-bottom: 60px; background-color: rgb(80, 80, 80); } </style>
Status: UNCONFIRMED → RESOLVED
Closed: 17 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.