Skip to content

Commit

Permalink
Replace queryClosestParent with Element.prototype.closest
Browse files Browse the repository at this point in the history
  • Loading branch information
devenini committed Oct 19, 2021
1 parent df56722 commit 082f3b5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions assets/scripts/utils/image.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { queryClosestParent } from './html';

const LAZY_LOADED_IMAGES = []

export function loadImage(url, options = {}) {
Expand Down Expand Up @@ -75,7 +73,7 @@ export async function lazyLoadImage($el, url, callback) {
}

requestAnimationFrame(() => {
let lazyParent = queryClosestParent($el, '.c-lazy')
let lazyParent = $el.closest('.c-lazy');

if(lazyParent) {
lazyParent.classList.add('-lazy-loaded')
Expand Down

0 comments on commit 082f3b5

Please sign in to comment.