Added css hook to work around bug in WebKit computed margin-right. Fixes #3333 - .css("marginRight") is incorrect in WebKit
This commit is contained in:
parent
0cf336d2c9
commit
c3c507e900
3 changed files with 44 additions and 1 deletions
19
src/css.js
19
src/css.js
|
@ -240,6 +240,25 @@ if ( !jQuery.support.opacity ) {
|
|||
};
|
||||
}
|
||||
|
||||
jQuery(function() {
|
||||
// This hook cannot be added until DOM ready because the support test
|
||||
// for it is not run until after DOM ready
|
||||
if ( !jQuery.support.reliableMarginRight ) {
|
||||
jQuery.cssHooks.marginRight = {
|
||||
get: function( elem, computed ) {
|
||||
// WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right
|
||||
// Work around by temporarily setting element display to inline-block
|
||||
var ret = "0px",
|
||||
display = elem.style.display;
|
||||
elem.style.display = "inline-block";
|
||||
ret = getComputedStyle( elem, "margin-right", "margin-right" );
|
||||
elem.style.display = display;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if ( document.defaultView && document.defaultView.getComputedStyle ) {
|
||||
getComputedStyle = function( elem, newName, name ) {
|
||||
var ret, defaultView, computedStyle;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue