SA-CORE-2022-001 by lauriii, cilefen, mcdruid, effulgentsia, bnjmnm, xjm, nod_

merge-requests/460/merge
xjm 2022-01-18 18:14:00 -06:00
parent 95d5d11301
commit 1e93f3aa50
5 changed files with 15 additions and 6 deletions

File diff suppressed because one or more lines are too long

View File

@ -144,7 +144,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( " " ),

View File

@ -434,7 +434,11 @@
const collision = (options.collision || 'flip').split(' ');
const offsets = {};
const target = $(options.of);
// Make sure string options are treated as CSS selectors
const target =
typeof options.of === 'string'
? $(document).find(options.of)
: $(options.of);
const dimensions = getDimensions(target);
const targetWidth = dimensions.width;
const targetHeight = dimensions.height;

View File

@ -266,7 +266,7 @@
var scrollInfo = $.position.getScrollInfo(within);
var collision = (options.collision || 'flip').split(' ');
var offsets = {};
var target = $(options.of);
var target = typeof options.of === 'string' ? $(document).find(options.of) : $(options.of);
var dimensions = getDimensions(target);
var targetWidth = dimensions.width;
var targetHeight = dimensions.height;

View File

@ -81,7 +81,7 @@ class ComposerHookTest extends TestCase {
// project is "allowed" in our main fixture project, but not required.
// We expect that requiring this library should re-scaffold, resulting
// in a changed default.settings.php file.
$stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/scaffold-override-fixture:dev-master", $sut);
$stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/drupal-assets-fixture:dev-master fixtures/scaffold-override-fixture:dev-master", $sut);
$this->assertScaffoldedFile($sut . '/sites/default/default.settings.php', FALSE, 'scaffolded from the scaffold-override-fixture');
// Make sure that the appropriate notice informing us that scaffolding
// is allowed was printed.
@ -120,7 +120,7 @@ class ComposerHookTest extends TestCase {
$this->mustExec("composer install --no-ansi", $sut);
// Require a project that is not allowed to scaffold and confirm that we
// get a warning, and it does not scaffold.
$stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/scaffold-override-fixture:dev-master", $sut);
$stdout = $this->mustExec("composer require --no-ansi --no-interaction fixtures/drupal-assets-fixture:dev-master fixtures/scaffold-override-fixture:dev-master", $sut);
$this->assertFileDoesNotExist($sut . '/sites/default/default.settings.php');
$this->assertStringContainsString("Not scaffolding files for fixtures/scaffold-override-fixture, because it is not listed in the element 'extra.drupal-scaffold.allowed-packages' in the root-level composer.json file.", $stdout);
}