diff --git a/src/attribution/onCLS.ts b/src/attribution/onCLS.ts index e6aa3e3e..9157f496 100644 --- a/src/attribution/onCLS.ts +++ b/src/attribution/onCLS.ts @@ -27,7 +27,7 @@ import { ReportOpts, } from '../types.js'; -// A reference to the LCP Target node incase it is removed before reporting +// A reference to the layout shift target node incase it is removed before reporting const layoutShiftTargetMap: WeakMap = new WeakMap(); @@ -50,7 +50,7 @@ const attributeCLS = (metric: CLSMetric): CLSMetricWithAttribution => { if (largestSource) { attribution = { largestShiftTarget: getSelector( - largestSource.node || layoutShiftTargetMap.get(largestEntry), + largestSource.node ?? layoutShiftTargetMap.get(largestEntry), ), largestShiftTime: largestEntry.startTime, largestShiftValue: largestEntry.value, diff --git a/test/e2e/onCLS-test.js b/test/e2e/onCLS-test.js index 5fd6782f..14db3f7c 100644 --- a/test/e2e/onCLS-test.js +++ b/test/e2e/onCLS-test.js @@ -867,7 +867,7 @@ describe('onCLS()', async function () { }); it('reports the target (reportAllChanges === true)', async function () { - // We can't guarantee the orer or reporting removed targets with + // We can't guarantee the order or reporting removed targets with // reportAllChanges so don't even try. Just test the target without // removal to compare to previous test if (!browserSupportsCLS) this.skip(); diff --git a/test/e2e/onINP-test.js b/test/e2e/onINP-test.js index e33d673f..e6cd54a3 100644 --- a/test/e2e/onINP-test.js +++ b/test/e2e/onINP-test.js @@ -742,7 +742,7 @@ describe('onINP()', async function () { }); it('includes target (reportAllChanges === true)', async function () { - // We can't guarantee the orer or reporting removed targets with + // We can't guarantee the order or reporting removed targets with // reportAllChanges so don't even try. Just test the target without // removal to compare to previous test if (!browserSupportsLoAF) this.skip(); diff --git a/test/e2e/onLCP-test.js b/test/e2e/onLCP-test.js index d1238525..37d6a8a1 100644 --- a/test/e2e/onLCP-test.js +++ b/test/e2e/onLCP-test.js @@ -705,7 +705,7 @@ describe('onLCP()', async function () { }); it('reports the target (reportAllChanges === true)', async function () { - // We can't guarantee the orer or reporting removed targets with + // We can't guarantee the order or reporting removed targets with // reportAllChanges so don't even try. Just test the targets without // removal to compare to previous test if (!browserSupportsLCP) this.skip();