diff options
author | Michał Gołębiowski-Owczarek <m.goleb@gmail.com> | 2021-05-04 13:31:39 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-04 13:31:39 +0200 |
commit | effa323f1505f2ce7a324e4f429fa9032c72f280 (patch) | |
tree | 088d41daccc854daa63abbf77557761c7afde734 /ui | |
parent | 32850869d308d5e7c9bf3e3b4d483ea886d373ce (diff) | |
download | jquery-ui-effa323f1505f2ce7a324e4f429fa9032c72f280.tar.gz jquery-ui-effa323f1505f2ce7a324e4f429fa9032c72f280.zip |
Position: Make sure `of` is treated as a CSS selector
Closes gh-1955
Diffstat (limited to 'ui')
-rw-r--r-- | ui/position.js | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/ui/position.js b/ui/position.js index 2d1969599..2bd814d93 100644 --- a/ui/position.js +++ b/ui/position.js @@ -148,7 +148,12 @@ $.fn.position = function( options ) { options = $.extend( {}, options ); var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), + + // Make sure string options are treated as CSS selectors + target = typeof options.of === "string" ? + $( document ).find( options.of ) : + $( options.of ), + within = $.position.getWithinInfo( options.within ), scrollInfo = $.position.getScrollInfo( within ), collision = ( options.collision || "flip" ).split( " " ), |