Side navigation
#1249 closed enhancement (invalid)
Opened May 28, 2007 04:41PM UTC
Closed January 18, 2009 03:33AM UTC
Normalizing borderWidth in ideal situations
Reported by: | blairmitchelmore | Owned by: | |
---|---|---|---|
Priority: | trivial | Milestone: | |
Component: | core | Version: | 1.1.2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
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;
}
Attachments (0)
Change History (1)
Changed January 18, 2009 03:33AM UTC by comment:1
resolution: | → invalid |
---|---|
status: | new → closed |
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.