diff options
author | Dave Methvin <dave.methvin@gmail.com> | 2019-10-21 12:53:24 -0400 |
---|---|---|
committer | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2019-10-21 18:53:24 +0200 |
commit | 57038faebc6ece5bd666c28303f8a91ff59153eb (patch) | |
tree | 613aeb4c5dcfb5a8ea962aba6f31217b7c01f27c /src | |
parent | 6d31477a35bfa70d209522b5e8c7e948b6c4d599 (diff) | |
download | jquery-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.js | 6 |
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 ); } } |