@@ -184,6 +184,27 @@ function reportNodeElements(
184184 }
185185}
186186
187+ function reportPointerElements (
188+ source : Element | Document ,
189+ fn : ( re : ReportedObject ) => void
190+ ) : void {
191+ source . querySelectorAll ( '*' ) . forEach ( ( element ) => {
192+ const { tagName} = element ;
193+ const url = window . location . href ;
194+ if (
195+ tagName !== 'input' &&
196+ tagName !== 'button' &&
197+ tagName !== 'a' &&
198+ element instanceof Element
199+ ) {
200+ const compStyles = window . getComputedStyle ( element , 'hover' ) ;
201+ if ( compStyles . getPropertyValue ( 'cursor' ) === 'pointer' ) {
202+ fn ( new ReportedElement ( element , url ) ) ;
203+ }
204+ }
205+ } ) ;
206+ }
207+
187208function reportPageLoaded (
188209 doc : Document ,
189210 fn : ( re : ReportedObject ) => void
@@ -197,6 +218,7 @@ function reportPageLoaded(
197218 reportPageForms ( doc , fn ) ;
198219 reportElements ( doc . getElementsByTagName ( 'input' ) , fn ) ;
199220 reportElements ( doc . getElementsByTagName ( 'button' ) , fn ) ;
221+ reportPointerElements ( doc , fn ) ;
200222 reportStorage ( LOCAL_STORAGE , localStorage , fn ) ;
201223 reportStorage ( SESSION_STORAGE , sessionStorage , fn ) ;
202224}
@@ -209,10 +231,14 @@ const domMutated = function domMutation(
209231 reportEvent ( new ReportedEvent ( 'domMutation' ) ) ;
210232 reportPageLinks ( document , reportObject ) ;
211233 reportPageForms ( document , reportObject ) ;
234+ reportPointerElements ( document , reportObject ) ;
212235 for ( const mutation of mutationList ) {
213236 if ( mutation . type === 'childList' ) {
214237 reportNodeElements ( mutation . target , 'input' , reportObject ) ;
215238 reportNodeElements ( mutation . target , 'button' , reportObject ) ;
239+ if ( mutation . target . nodeType === Node . ELEMENT_NODE ) {
240+ reportPointerElements ( mutation . target as Element , reportObject ) ;
241+ }
216242 }
217243 }
218244 } ) ;
0 commit comments