Closed Bug 1424255 Opened 8 years ago Closed 8 years ago

window.getComputedStyle(element)['borderWidth'] returns an empty string

Categories

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

50 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: 1508235075, Unassigned)

Details

User Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36 Steps to reproduce: I try to use window.getComputedStyle()['borderWidth'] to get the width of an element, but firefox return empty string, I can only get the width of one border, like window.getComputedStyle()['borderLeftWidth'] eg: html: <ul id="border_test"> <li></li> <li></li> <li></li> <li></li> </ul> css: #border_test li { width: 10px; height: 10px; background: #ccc; margin: 10px; border: 1px solid #000; } #border_test li:nth-child(2) { border-left-width: 30px; } js: window.getComputedStyle(liAll[1])['borderWidth']; // return empty string Actual results: return empty string Expected results: In the above example it should return '1px 1px 1px 30px'
Per the specification (https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle) only longhand properties are returned. border-width is a shorthand property (https://developer.mozilla.org/en-US/docs/Web/CSS/border-width)
Status: UNCONFIRMED → RESOLVED
Closed: 8 years ago
Resolution: --- → INVALID
You need to log in before you can comment on or make changes to this bug.