File tree Expand file tree Collapse file tree 1 file changed +15
-6
lines changed
Expand file tree Collapse file tree 1 file changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -437,12 +437,21 @@ jQuery.cssHooks.marginRight = addGetHookIf( support.reliableMarginRight,
437437jQuery . cssHooks . marginLeft = addGetHookIf ( support . reliableMarginLeft ,
438438 function ( elem , computed ) {
439439 if ( computed ) {
440- return ( parseFloat ( curCSS ( elem , "marginLeft" ) ) ||
441- elem . getBoundingClientRect ( ) . left -
442- swap ( elem , { marginLeft : 0 } , function ( ) {
443- return elem . getBoundingClientRect ( ) . left ;
444- } )
445- ) + "px" ;
440+ return (
441+ parseFloat ( curCSS ( elem , "marginLeft" ) ) ||
442+
443+ // Support: IE<=11+
444+ // Running getBoundingClientRect on a disconnected node in IE throws an error
445+ // Support: IE8 only
446+ // getClientRects() errors on disconnected elems
447+ ( jQuery . contains ( elem . ownerDocument , elem ) ?
448+ elem . getBoundingClientRect ( ) . left -
449+ swap ( elem , { marginLeft : 0 } , function ( ) {
450+ return elem . getBoundingClientRect ( ) . left ;
451+ } ) :
452+ 0
453+ )
454+ ) + "px" ;
446455 }
447456 }
448457) ;
You can’t perform that action at this time.
0 commit comments