1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00

node.remove() exists, so why have I been doing node.parentElement.removeChild(node). I am literally the worst.

This commit is contained in:
SirStendec 2017-12-01 15:36:18 -05:00
parent ddee1e3bb5
commit fcc3cab35f
9 changed files with 10 additions and 15 deletions

View file

@ -28,7 +28,7 @@ export default {
const btn = container.querySelector('#ffz-old-news-button'); const btn = container.querySelector('#ffz-old-news-button');
if ( btn ) if ( btn )
btn.addEventListener('click', () => { btn.addEventListener('click', () => {
btn.parentElement.removeChild(btn); btn.remove();
const old_news = container.querySelector('#ffz-old-news'); const old_news = container.querySelector('#ffz-old-news');
if ( old_news ) if ( old_news )
this.fetch(`${SERVER}/script/old_changes.html`, old_news); this.fetch(`${SERVER}/script/old_changes.html`, old_news);

View file

@ -89,7 +89,7 @@ export default {
async: true, async: true,
charset: 'utf-8', charset: 'utf-8',
src: 'https://platform.twitter.com/widgets.js', src: 'https://platform.twitter.com/widgets.js',
onLoad: () => el.parentElement.removeChild(el) onLoad: () => el.remove()
})); }));
} }

View file

@ -121,7 +121,7 @@ export default class MainMenu extends Module {
main.classList.remove('ffz-has-menu'); main.classList.remove('ffz-has-menu');
if ( this._menu ) { if ( this._menu ) {
main.removeChild(this._menu); this._menu.remove();
this._vue.$destroy(); this._vue.$destroy();
this._menu = this._vue = null; this._menu = this._vue = null;
} }
@ -151,7 +151,7 @@ export default class MainMenu extends Module {
else else
old_main.classList.remove('ffz-has-menu'); old_main.classList.remove('ffz-has-menu');
old_main.removeChild(this._menu); this._menu.remove();
main.appendChild(this._menu); main.appendChild(this._menu);
this._vue.$children[0].maximized = maximized; this._vue.$children[0].maximized = maximized;

View file

@ -240,7 +240,7 @@ export default class Metadata extends Module {
el.popper.destroy(); el.popper.destroy();
el.tooltip = el.popper = null; el.tooltip = el.popper = null;
el.parentElement.removeChild(el); el.remove();
} }
}; };

View file

@ -243,7 +243,7 @@ export default class Scroller extends Module {
this._ffz_freeze_visible = false; this._ffz_freeze_visible = false;
if ( this._ffz_freeze_indicator ) { if ( this._ffz_freeze_indicator ) {
node.removeChild(this._ffz_freeze_indicator); this._ffz_freeze_indicator.remove();
this._ffz_freeze_indicator = null; this._ffz_freeze_indicator = null;
} }

View file

@ -106,7 +106,7 @@ export default class MenuButton extends SiteModule {
this.off('i18n:update', this.onTranslate); this.off('i18n:update', this.onTranslate);
if ( this._el ) if ( this._el )
this._el.parentElement.removeChild(this._el); this._el.remove();
this._pill = this._tip = this._el = null; this._pill = this._tip = this._el = null;
} }

View file

@ -64,10 +64,8 @@ export default class ThemeEngine extends Module {
}); });
} else if ( ! enable ) { } else if ( ! enable ) {
if ( this._style.parentElement === document.head ) this._style.remove();
document.head.removeChild(this._style);
return; return;
} }
document.head.appendChild(this._style); document.head.appendChild(this._style);

View file

@ -126,7 +126,7 @@ export class ManagedStyle {
} }
destroy() { destroy() {
document.head.removeChild(this._style); this._style.remove();
this._blocks = null; this._blocks = null;
this._style = null; this._style = null;
} }

View file

@ -291,10 +291,7 @@ export class Tooltip {
} }
if ( tip.outer ) { if ( tip.outer ) {
const o = tip.outer; tip.outer.remove();
if ( o.parentElement )
o.parentElement.removeChild(o);
tip.outer = null; tip.outer = null;
} }