You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We noticed a bug in getSelector when the FID eventTarget is an SVG. When the eventTarget is an SVG, the value of className is an SVGAnimatedString, which doesn't have a trim() method, so an exception is thrown and caught by the catch and an empty selector string is returned (or whatever the selector was up until the SVG element was encountered). https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/getSelector.ts#L33
I believe using el.getAttribute('class') would work correctly in this case, with the caveat that getAttribute can return null as well as a string. We also noticed that el.classList.value worked in this case, but I'm not sure what the compatibility requirements for this project are.
I'll can put up a quick PR with the classList solution (or fallback to using getAttribute if that's preferred)
The text was updated successfully, but these errors were encountered:
Hi there 👋
We noticed a bug in
getSelector
when the FID eventTarget is an SVG. When the eventTarget is an SVG, the value ofclassName
is an SVGAnimatedString, which doesn't have atrim()
method, so an exception is thrown and caught by thecatch
and an empty selector string is returned (or whatever the selector was up until the SVG element was encountered). https://github.com/GoogleChrome/web-vitals/blob/main/src/lib/getSelector.ts#L33I believe using
el.getAttribute('class')
would work correctly in this case, with the caveat thatgetAttribute
can returnnull
as well as a string. We also noticed thatel.classList.value
worked in this case, but I'm not sure what the compatibility requirements for this project are.I'll can put up a quick PR with the classList solution (or fallback to using getAttribute if that's preferred)
The text was updated successfully, but these errors were encountered: