Skip to content

Commit f4285d6

Browse files
committed
Merge branch '5.x' of https://github.com/craftcms/cms into 6.x
# Conflicts: # CHANGELOG.md # bootstrap/bootstrap.php # src/elements/Entry.php # src/helpers/Html.php # src/helpers/HtmlPurifier.php # tests/unit/helpers/HtmlHelperTest.php
2 parents 5ffddaf + 96a324d commit f4285d6

4 files changed

Lines changed: 17 additions & 8 deletions

File tree

src/Entry/Elements/Entry.php

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2768,14 +2768,17 @@ protected function partialTemplatePathCandidates(): array
27682768
$entryType = $this->getType();
27692769

27702770
if (isset($entryType->original) && $entryType->original->handle !== $entryType->handle) {
2771-
$templates[] = [
2772-
'template' => sprintf(
2773-
'%s/%s/%s',
2774-
Cms::config()->partialTemplatesPath,
2775-
self::refHandle(),
2776-
$entryType->original->handle,
2777-
),
2778-
'priority' => 5,
2771+
return [
2772+
[
2773+
'template' => sprintf(
2774+
'%s/%s/%s',
2775+
Cms::config()->partialTemplatesPath,
2776+
self::refHandle(),
2777+
$entryType->original->handle,
2778+
),
2779+
'priority' => 5,
2780+
],
2781+
...$templates,
27792782
];
27802783
}
27812784

src/Support/Html.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -992,6 +992,7 @@ function (array $match) use ($namespace, $ids): string {
992992
foreach ($matchIds as $i => $id) {
993993
if (
994994
$i % 2 === 0 && // not a delimiter
995+
$id !== '' && // check if it's not an empty string, or the next line will error
995996
$id[0] !== '.' // not a class name
996997
) {
997998
$isHash = $id[0] === '#';

tests/Unit/Support/HtmlTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@ function normalizeParseTagInfo(array $info): array
390390
['<div id="foo-bar"></div><div data-reverse-target="#foo-bar, #foo-bar .foo"></div>', '<div id="bar"></div><div data-reverse-target="#bar, #bar .foo"></div>', 'foo', false],
391391
['<div id="foo-bar"></div><div data-target-prefix="#foo-"></div>', '<div id="bar"></div><div data-target-prefix="#"></div>', 'foo', false],
392392
['<div id="foo-bar"></div><div data-target-prefix></div>', '<div id="bar"></div><div data-target-prefix></div>', 'foo', false],
393+
// https://github.com/craftcms/cms/issues/18957
394+
['<div for=" "></div>', '<div for=" "></div>', 'foo', false],
393395
]);
394396

395397
test('Widont', function (string $expected, string $string): void {

yii2-adapter/legacy/helpers/HtmlPurifier.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ public static function configure($config): void
8080
$config->set('Attr.DefaultImageAlt', '');
8181
$config->set('Attr.DefaultInvalidImageAlt', '');
8282

83+
// allow HTML5 ID attributes by default
84+
$config->set('Attr.ID.HTML5', true);
85+
8386
// Add support for some HTML5 elements
8487
// see https://github.com/mewebstudio/Purifier/issues/32#issuecomment-182502361
8588
// see https://gist.github.com/lluchs/3303693

0 commit comments

Comments
 (0)