Ticket #1249 (closed enhancement: invalid)
Normalizing borderWidth in ideal situations
| Reported by: | blairmitchelmore | Owned by: | |
|---|---|---|---|
| Priority: | trivial | Milestone: | |
| Component: | core | Version: | 1.1.2 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
If you define an element with a border of "1px solid black" then the call $(element).css("borderWidth") firefox returns "1px 1px 1px 1px"
It would be neat if jQuery could recognize cases like this and fix it to return a single value.
One possible implementation: curCSS: function(...) {
...
if (prop == 'borderWidth') {
var vals = ret.split(/\s+/); if (vals.length > 1) {
vals = jQuery.map(vals,function(a,i) {
return jQuery.inArray(a,vals) != i ? null : a;
}); ret = vals.length == 1 ? vals[0] : ret;
}
}
return ret;
}
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

I have needed borderWidth values for two plugins, and both times I've needed to collect the individual border widths for each side of the element.
Since the caller often wouldn't know which case applied before making the call, it would have to handle both the current situation (four values separated by spaces) and the "optimized" case (a single value). So it seems like this would make things more complicated for both jQuery and the caller.