Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 13 additions & 4 deletions core/js/js.js
Original file line number Diff line number Diff line change
Expand Up @@ -2666,10 +2666,19 @@ $.fn.position = function( options ) {

var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions,

// Make sure string options are treated as CSS selectors
target = typeof options.of === "string" ?
$( document ).find( options.of ) :
$( options.of ),
// Make sure string options are treated as CSS selectors and avoid HTML parsing
target = ( function( of ) {
if ( typeof of === "string" ) {
return $( document ).find( of );
}
if ( of && of.target ) {
return $( of.target );
}
if ( of && ( of.jquery || of.nodeType || of === window || of === document ) ) {
return $( of );
}
return $();
} )( options.of ),

within = $.position.getWithinInfo( options.within ),
scrollInfo = $.position.getScrollInfo( within ),
Expand Down