diff --git a/src/index.js b/src/index.js index 0f55087..89ed4a1 100644 --- a/src/index.js +++ b/src/index.js @@ -99,9 +99,9 @@ sampleRUM.drain('cwv', (() => { data.cwv[measurement.name] = measurement.value; if (measurement.name === 'LCP' && measurement.entries.length > 0) { - const { element } = measurement.entries.pop(); - data.target = sampleRUM.targetselector(element); - data.source = sampleRUM.sourceselector(element) || element.outerHTML.slice(0, 30); + const { element: el } = measurement.entries.pop(); + data.target = sampleRUM.targetselector(el); + data.source = sampleRUM.sourceselector(el) || (el && el.outerHTML.slice(0, 30)); } sampleRUM('cwv', data);