Break Tags Are Stripped on Specific Filters

Created on 27 November 2023, 7 months ago
Updated 1 December 2023, 7 months ago

Problem/Motivation

Some filter plugins appear to strip the closing slash off break (br) tags. This, in combination with the _filter_autop function causes extra break tags to be added to content.

Steps to reproduce

use Drupal\Component\Utility\Html;

$testString = <<<EOS
<p>XYZ Corporation<br />
Marketing Dept<br />
PO Box 1234<br />
Anytown, 0H 12345-1234</p>
EOS;

echo "before: ${testString}\n" . PHP_EOL;

echo "after: " . Html::serialize(Html::load($testString)) . PHP_EOL;

Expectation

Expected break tags to retain their XHTML-compliant structure post-filter.

πŸ› Bug report
Status

Closed: works as designed

Version

10.1 ✨

Component
FilterΒ  β†’

Last updated 2 days ago

No maintainer
Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.69.0 2024