summaryrefslogtreecommitdiff
path: root/ext/js/dom
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-03-01 22:45:03 -0500
committerGitHub <noreply@github.com>2021-03-01 22:45:03 -0500
commit0e705292cc0c1196901e53670e7b89a70cc1556c (patch)
tree779305d696cfa6b5d3e9296709e0f2d3fd49d76a /ext/js/dom
parent0dab38f0a62c0bde4d8c32ec16f9d2a0672b85eb (diff)
Remove zero-width space (#1475)
Diffstat (limited to 'ext/js/dom')
-rw-r--r--ext/js/dom/dom-text-scanner.js3
-rw-r--r--ext/js/dom/text-source-element.js4
2 files changed, 4 insertions, 3 deletions
diff --git a/ext/js/dom/dom-text-scanner.js b/ext/js/dom/dom-text-scanner.js
index 71e74fc3..8010dd97 100644
--- a/ext/js/dom/dom-text-scanner.js
+++ b/ext/js/dom/dom-text-scanner.js
@@ -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;
diff --git a/ext/js/dom/text-source-element.js b/ext/js/dom/text-source-element.js
index 1576bd5e..499ee45d 100644
--- a/ext/js/dom/text-source-element.js
+++ b/ext/js/dom/text-source-element.js
@@ -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;
}