aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDave Methvin <dave.methvin@gmail.com>2019-10-21 12:53:24 -0400
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>2019-10-21 18:53:24 +0200
commit57038faebc6ece5bd666c28303f8a91ff59153eb (patch)
tree613aeb4c5dcfb5a8ea962aba6f31217b7c01f27c /src
parent6d31477a35bfa70d209522b5e8c7e948b6c4d599 (diff)
downloadjquery-57038faebc6ece5bd666c28303f8a91ff59153eb.tar.gz
jquery-57038faebc6ece5bd666c28303f8a91ff59153eb.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/offset.js6
1 files changed, 6 insertions, 0 deletions
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 );
}
}