From 09efcb48a4c1e22c0cef467adc9cfcefe2818c0d Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 23 Jul 2019 15:43:03 -0400 Subject: [PATCH 1/3] try to use the closest a tag as target --- src/components/status/status.js | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index faefb80e..f87a2413 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -323,10 +323,8 @@ const Status = { }, linkClicked (event) { let { target } = event - if (target.tagName === 'SPAN') { - target = target.parentNode - } - if (target.tagName === 'A') { + target = target.tagName === 'A' ? target : target.closest('a') + if (target) { if (target.className.match(/mention/)) { const href = target.href const attn = this.status.attentions.find(attn => mentionMatchesUrl(attn, href)) From 17ad5bbdf9cfa108164a128921742828182f03b6 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 23 Jul 2019 15:44:41 -0400 Subject: [PATCH 2/3] find inside status-content div only --- src/components/status/status.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index f87a2413..7f7c8f1e 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -323,7 +323,7 @@ const Status = { }, linkClicked (event) { let { target } = event - target = target.tagName === 'A' ? target : target.closest('a') + target = target.tagName === 'A' ? target : target.closest('.status-content a') if (target) { if (target.className.match(/mention/)) { const href = target.href From 1cefaa8446a45273f95649844fa0172221ecee38 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 23 Jul 2019 20:59:37 -0400 Subject: [PATCH 3/3] closest can returns itself as well --- src/components/status/status.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/status/status.js b/src/components/status/status.js index 7f7c8f1e..3c172e5b 100644 --- a/src/components/status/status.js +++ b/src/components/status/status.js @@ -322,8 +322,7 @@ const Status = { this.error = undefined }, linkClicked (event) { - let { target } = event - target = target.tagName === 'A' ? target : target.closest('.status-content a') + const target = event.target.closest('.status-content a') if (target) { if (target.className.match(/mention/)) { const href = target.href