Skip to content

Commit

Permalink
Simplify
Browse files Browse the repository at this point in the history
  • Loading branch information
compulim committed Oct 26, 2024
1 parent 7962478 commit b5dbbca
Showing 1 changed file with 3 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,16 @@ class CodeBlockCopyButtonElement extends HTMLElement {
constructor() {
super();

const copiedIconImageElement = this.ownerDocument.createElement('div');
const copiedIconImageElement = (this.#copiedIconImageElement = this.ownerDocument.createElement('div'));

copiedIconImageElement.ariaLabel = this.dataset.altCopied;
copiedIconImageElement.classList.add(
'webchat__code-block-copy-button__icon',
'webchat__code-block-copy-button__icon--copied'
);
copiedIconImageElement.role = 'img';

const copyIconImageElement = this.ownerDocument.createElement('div');
const copyIconImageElement = (this.#copyIconImageElement = this.ownerDocument.createElement('div'));

copyIconImageElement.ariaLabel = this.dataset.altCopy;
copyIconImageElement.classList.add(
'webchat__code-block-copy-button__icon',
'webchat__code-block-copy-button__icon--copy'
Expand All @@ -33,7 +31,7 @@ class CodeBlockCopyButtonElement extends HTMLElement {
const buttonElement = (this.#buttonElement = this.ownerDocument.createElement('button'));

buttonElement.ariaLive = 'assertive'; // Needed to narrate when the button is pressed.
buttonElement.classList.add('webchat__code-block-copy-button', this.className);
buttonElement.classList.add('webchat__code-block-copy-button');
buttonElement.dataset.testid = testIds.codeBlockCopyButton;
buttonElement.type = 'button';

Expand Down Expand Up @@ -84,10 +82,6 @@ class CodeBlockCopyButtonElement extends HTMLElement {
}
})();
});

this.#buttonElement = buttonElement;
this.#copiedIconImageElement = copiedIconImageElement;
this.#copyIconImageElement = copyIconImageElement;
}

#buttonElement: HTMLButtonElement;
Expand Down

0 comments on commit b5dbbca

Please sign in to comment.