Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Aug 13, 2024
1 parent a1d980a commit 011493d
Showing 1 changed file with 11 additions and 28 deletions.
39 changes: 11 additions & 28 deletions webextensions/sidebar/components/TabElement.js
Original file line number Diff line number Diff line change
Expand Up @@ -310,29 +310,17 @@ export class TabElement extends HTMLElement {
if (!this.initialized)
return;

if (targets & TabInvalidationTarget.Twisty) {
const twisty = this.twisty;
if (twisty)
twisty.invalidate();
}
if (targets & TabInvalidationTarget.Twisty)
this.twisty?.invalidate();

if (targets & TabInvalidationTarget.SharingState) {
const sharingState = this._sharingStateElement;
if (sharingState)
sharingState.invalidate();
}
if (targets & TabInvalidationTarget.SharingState)
this._sharingStateElement?.invalidate();

if (targets & TabInvalidationTarget.SoundButton) {
const soundButton = this._soundButtonElement;
if (soundButton)
soundButton.invalidate();
}
if (targets & TabInvalidationTarget.SoundButton)
this._soundButtonElement?.invalidate();

if (targets & TabInvalidationTarget.CloseBox) {
const closeBox = this.closeBox;
if (closeBox)
closeBox.invalidate();
}
if (targets & TabInvalidationTarget.CloseBox)
this.closeBox?.invalidate();

if (targets & TabInvalidationTarget.Tooltip)
this.invalidateTooltip();
Expand All @@ -356,11 +344,8 @@ export class TabElement extends HTMLElement {
if (!this.initialized)
return;

if (targets & TabUpdateTarget.Counter) {
const counter = this._counterElement;
if (counter)
counter.update();
}
if (targets & TabUpdateTarget.Counter)
this._counterElement?.update();

if (targets & TabUpdateTarget.Overflow)
this._updateOverflow();
Expand All @@ -383,9 +368,7 @@ export class TabElement extends HTMLElement {

_updateOverflow() {
this._needToUpdateOverflow = false;
const label = this._labelElement;
if (label)
label.updateOverflow();
this._labelElement?.updateOverflow();
}

_updateTooltip() {
Expand Down

0 comments on commit 011493d

Please sign in to comment.