Skip to content

Commit

Permalink
remove use of "window."
Browse files Browse the repository at this point in the history
  • Loading branch information
Corentin Gautier committed Jul 31, 2022
1 parent 4e77883 commit 4ad3667
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions js/accordion-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ class AccordionItem extends HTMLElement {
* @returns Boolean
*/
isInHash() {
return parseInt(window.location.hash.replace('#', ''), 10) === this.uuid;
return parseInt(location.hash.replace('#', ''), 10) === this.uuid;
}

/**
Expand Down Expand Up @@ -204,7 +204,7 @@ class AccordionItem extends HTMLElement {
setTimeout(() => {
requestIdleCallback(() => {
const currentPos = this.getBoundingClientRect().top;
window.scrollTo({
scrollTo({
top: (currentPos + document.documentElement.scrollTop) - this.config.scrollOffset,
behavior: 'smooth'
});
Expand Down Expand Up @@ -253,14 +253,14 @@ class AccordionItem extends HTMLElement {
* Dispatch a resize event after opening or closing the item
*/
triggerResize() {
window.dispatchEvent(new Event('resize'));
dispatchEvent(new Event('resize'));
}
}

/**
* Register custom elements & hashchange listener
*/
if (window.customElements) {
if (typeof customElements !== 'undefined') {
customElements.define('accordion-item', AccordionItem);

addEventListener('hashchange', () => {
Expand Down
2 changes: 1 addition & 1 deletion js/accordion-blocks.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4ad3667

Please sign in to comment.