summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/modules/masterbar/tracks-events.js')
-rw-r--r--plugins/jetpack/modules/masterbar/tracks-events.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/plugins/jetpack/modules/masterbar/tracks-events.js b/plugins/jetpack/modules/masterbar/tracks-events.js
index 7cf95e88..10b63f80 100644
--- a/plugins/jetpack/modules/masterbar/tracks-events.js
+++ b/plugins/jetpack/modules/masterbar/tracks-events.js
@@ -97,7 +97,7 @@
'#wp-admin-bar-user-info .ab-item,' +
'.mb-trackable .ab-secondary';
- $( trackableLinks ).on( 'click touchstart', function( e ) {
+ $( trackableLinks ).on( 'click touchstart', function( e ) {
if ( ! window.jpTracksAJAX || 'function' !== typeof( window.jpTracksAJAX.record_ajax_event ) ) {
return;
}
@@ -105,7 +105,11 @@
var $target = $( e.target ),
$parent = $target.closest( 'li' );
- if ( ! $parent ) {
+ if ( ! $target.is( 'a' ) ) {
+ $target = $target.closest( 'a' );
+ }
+
+ if ( ! $parent || ! $target ) {
return;
}