Remove zero-width space (#1475)

This commit is contained in:
toasted-nutbread 2021-03-01 22:45:03 -05:00 committed by GitHub
parent 0dab38f0a6
commit 0e705292cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -462,7 +462,8 @@ class DOMTextScanner {
return preserveWhitespace ? 2 : 1;
case 0x0a: // Line feed ('\n')
return preserveNewlines ? 3 : 1;
case 0x200c: // Zero-width non-joiner ('\u200c')
case 0x200b: // Zero-width space
case 0x200c: // Zero-width non-joiner
return 0;
default: // Other
return 2;

View File

@ -138,8 +138,8 @@ class TextSourceElement {
break;
}
// Remove zero-width non-joiner
content = content.replace(/\u200c/g, '');
// Remove zero-width space and zero-width non-joiner
content = content.replace(/[\u200b\u200c]/g, '');
return content;
}