Skip to content

Commit

Permalink
refactor: rename internal skipChildren option name
Browse files Browse the repository at this point in the history
  • Loading branch information
johannschopplich committed Nov 13, 2024
1 parent 66336cf commit 456b939
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/core/src/lazyLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ function updateSizesAttribute(
element: HTMLImageElement | HTMLSourceElement,
options?: {
updateOnResize?: boolean
skipChildren?: boolean
processSourceElements?: boolean
},
) {
if (element.dataset.sizes !== 'auto')
Expand All @@ -207,9 +207,9 @@ function updateSizesAttribute(
element.sizes = `${width}px`

// Calculate the `sizes` attribute for sources inside a `<picture>` element
if (isDescendantOfPicture(element) && !options?.skipChildren) {
if (isDescendantOfPicture(element) && options?.processSourceElements) {
for (const sourceTag of [...element.parentElement.getElementsByTagName('source')]) {
updateSizesAttribute(sourceTag, { skipChildren: true })
updateSizesAttribute(sourceTag, { processSourceElements: true })
}
}

Expand Down

0 comments on commit 456b939

Please sign in to comment.