modifier: Fix whitespace trim inconsistency

The JS and PHP trim() methods remove different characters.

Change-Id: I8ae5526ea5033e345b6a6b63ea447c394956d988
This commit is contained in:
Bartosz Dziewoński 2021-03-24 18:48:04 +01:00
parent 4ae22ab6dc
commit 3ac540af95
2 changed files with 2 additions and 2 deletions

View file

@ -478,7 +478,7 @@ class CommentModifier {
// If the last node is empty, trim the signature to prevent leading whitespace triggering
// preformatted text (T269188, T276612)
if ( !$container->lastChild->firstChild ) {
$signature = trim( $signature );
$signature = ltrim( $signature, ' ' );
}
// Sign the last line
$container->lastChild->appendChild(

View file

@ -434,7 +434,7 @@ function appendSignature( container ) {
// If the last node is empty, trim the signature to prevent leading whitespace triggering
// preformatted text (T269188, T276612)
if ( !container.lastChild.firstChild ) {
signature = signature.trim();
signature = signature.replace( /^ +/, '' );
}
// Sign the last line
container.lastChild.appendChild(