mirror of
https://github.com/jquery/jquery.git
synced 2026-05-13 03:00:12 -04:00
Fix #12243, $("col").width() should return the column's width. Close gh-916.
This commit is contained in:
committed by
Dave Methvin
parent
be2899b3b1
commit
670e3ff040
11
src/css.js
11
src/css.js
@@ -2,6 +2,9 @@ var curCSS, iframe, iframeDoc,
|
||||
ralpha = /alpha\([^)]*\)/i,
|
||||
ropacity = /opacity=([^)]*)/,
|
||||
rposition = /^(top|right|bottom|left)$/,
|
||||
// swappable if display is none or starts with table except "table", "table-cell", or "table-caption"
|
||||
// see here for display values: https://developer.mozilla.org/en-US/docs/CSS/display
|
||||
rdisplayswap = /^(none|table(?!-c[ea]).+)/,
|
||||
rmargin = /^margin/,
|
||||
rnumsplit = new RegExp( "^(" + core_pnum + ")(.*)$", "i" ),
|
||||
rnumnonpx = new RegExp( "^(" + core_pnum + ")(?!px)[a-z%]+$", "i" ),
|
||||
@@ -493,12 +496,14 @@ jQuery.each([ "height", "width" ], function( i, name ) {
|
||||
jQuery.cssHooks[ name ] = {
|
||||
get: function( elem, computed, extra ) {
|
||||
if ( computed ) {
|
||||
if ( elem.offsetWidth !== 0 || curCSS( elem, "display" ) !== "none" ) {
|
||||
return getWidthOrHeight( elem, name, extra );
|
||||
} else {
|
||||
// certain elements can have dimension info if we invisibly show them
|
||||
// however, it must have a current display style that would benefit from this
|
||||
if ( elem.offsetWidth === 0 && rdisplayswap.test( curCSS( elem, "display" ) ) ) {
|
||||
return jQuery.swap( elem, cssShow, function() {
|
||||
return getWidthOrHeight( elem, name, extra );
|
||||
});
|
||||
} else {
|
||||
return getWidthOrHeight( elem, name, extra );
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user