aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/source.js
diff options
context:
space:
mode:
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;
}