aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/source.js
diff options
context:
space:
mode:
authorAlex Yatskov <FooSoft@users.noreply.github.com>2019-09-02 08:30:19 -0700
committerGitHub <noreply@github.com>2019-09-02 08:30:19 -0700
commit037363e3a70675a580431d2ee891e3d88fae511c (patch)
treed42dab6f73fdcc52b9192a29cc1e1219608ca035 /ext/fg/js/source.js
parenteee89fa1853b80d563bc9ef5ba05d9a9e8ee2d0d (diff)
parente3d7ec8db7a86d475fba00d48f9cbe150feb36ff (diff)
Merge pull request #197 from toasted-nutbread/imposter-improvements
Imposter element improvements
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..69d8197d 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, imposterContainer) {
this.range = range;
this.content = content;
+ this.imposterContainer = imposterContainer;
}
clone() {
- return new TextSourceRange(this.range.cloneRange(), this.content);
+ return new TextSourceRange(this.range.cloneRange(), this.content, this.imposterContainer);
+ }
+
+ cleanup() {
+ if (this.imposterContainer !== null && this.imposterContainer.parentNode !== null) {
+ this.imposterContainer.parentNode.removeChild(this.imposterContainer);
+ }
}
text() {
@@ -221,6 +228,10 @@ class TextSourceElement {
return new TextSourceElement(this.element, this.content);
}
+ cleanup() {
+ // NOP
+ }
+
text() {
return this.content;
}