Skip to content
Permalink
Browse files
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
  • Loading branch information
dmethvin authored and mgol committed Oct 21, 2019
1 parent 6d31477 commit 57038faebc6ece5bd666c28303f8a91ff59153eb
Showing 1 changed file with 6 additions and 0 deletions.
@@ -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 );
}
}

0 comments on commit 57038fa

Please sign in to comment.