Bug Tracker

Opened 15 years ago

Closed 14 years ago

#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:
Blocked by: Blocking:


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 (1)

comment:1 Changed 14 years ago by dmethvin

Resolution: invalid
Status: newclosed

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.

Note: See TracTickets for help on using tickets.