summaryrefslogtreecommitdiff
path: root/ext/fg/js/source.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-31 14:57:24 -0400
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-08-31 14:57:50 -0400
commitad0dca7bb12d13545b559e9c738fcc0767ba20d5 (patch)
treec3a27f29d185ba06c7fac98f65a54a952d131a2d /ext/fg/js/source.js
parente47e041217708c49032dd3d215eacb23276a1f59 (diff)
Make the imposter element tracked using TextSourceRange
Diffstat (limited to 'ext/fg/js/source.js')
-rw-r--r--ext/fg/js/source.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/fg/js/source.js b/ext/fg/js/source.js
index a360b331..409e81aa 100644
--- a/ext/fg/js/source.js
+++ b/ext/fg/js/source.js
@@ -25,13 +25,20 @@ const IGNORE_TEXT_PATTERN = /\u200c/;
*/
class TextSourceRange {
- constructor(range, content='') {
+ constructor(range, content, imposter) {
this.range = range;
this.content = content;
+ this.imposter = imposter;
}
clone() {
- return new TextSourceRange(this.range.cloneRange(), this.content);
+ return new TextSourceRange(this.range.cloneRange(), this.content, this.imposter);
+ }
+
+ cleanup() {
+ if (this.imposter !== null && this.imposter.parentNode !== null) {
+ this.imposter.parentNode.removeChild(this.imposter);
+ }
}
text() {
@@ -221,6 +228,10 @@ class TextSourceElement {
return new TextSourceElement(this.element, this.content);
}
+ cleanup() {
+ // NOP
+ }
+
text() {
return this.content;
}