From 57038faebc6ece5bd666c28303f8a91ff59153eb Mon Sep 17 00:00:00 2001 From: Dave Methvin Date: Mon, 21 Oct 2019 12:53:24 -0400 Subject: [PATCH] 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 --- src/offset.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/offset.js b/src/offset.js index 6e9735870..62166bc99 100644 --- a/src/offset.js +++ b/src/offset.js @@ -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 ); } } -- 2.39.5