Skip to content

Commit

Permalink
Use template literals for query selectors, use forEach instead of for
Browse files Browse the repository at this point in the history
  • Loading branch information
boggs committed Oct 21, 2021
1 parent b9615af commit 9e00969
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,9 @@ class MozfestHeroCarousel {

const MozfestHeroCarousels = {
init: function () {
for (const carousel of document.querySelectorAll(
"[data-mozfest-hero-carousel]"
)) {
new MozfestHeroCarousel(carousel);
}
document
.querySelectorAll(`[data-mozfest-hero-carousel]`)
.forEach((e) => new MozfestHeroCarousel(e));
},
};

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import {ReactGA} from "../../../../common";
import { ReactGA } from "../../../../common";

// For the featured banner type on mozefest homepage
const watchFeaturedVideoHandler = () => {
const watchVideoButton = document.querySelector(
`#mozfest-home-watch-featured-video-button`
);
const externalVideo = document.querySelector("#mozfest-hero-video iframe");
const internalVideo = document.querySelector("#mozfest-hero-video video");
const externalVideo = document.querySelector(`#mozfest-hero-video iframe`);
const internalVideo = document.querySelector(`#mozfest-hero-video video`);

// If no video exists then do nothing
if (!externalVideo && !internalVideo) {
Expand Down
2 changes: 1 addition & 1 deletion source/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ let main = {
}

// Mozfest pages
if (document.querySelector(".mozfest")) {
if (document.querySelector(`.mozfest`)) {
MozfestHeroCarousels.init();
}
},
Expand Down

0 comments on commit 9e00969

Please sign in to comment.