Offset: Send px-ed strings to .css()

An upcoming release of Migrate will generate warnings for calls to .css() that pass numbers rather than strings, see jquery/jquery-migrate#296 . At the moment, core's .offset() setter passes numbers rather than px strings so it would throw warnings. This commit fixes that.

Closes gh-4508
This commit is contained in:
Dave Methvin 2019-10-21 12:53:24 -04:00 committed by Michał Gołębiowski-Owczarek
parent 6d31477a35
commit 57038faebc

View File

@ -63,6 +63,12 @@ jQuery.offset = {
options.using.call( elem, props );
} else {
if ( typeof props.top === "number" ) {
props.top += "px";
}
if ( typeof props.left === "number" ) {
props.left += "px";
}
curElem.css( props );
}
}