From 9f40d951021aa452b0cb8020c8ef1c2f5e68d069 Mon Sep 17 00:00:00 2001 From: Sean Steimer Date: Tue, 16 Apr 2024 15:35:05 -0700 Subject: [PATCH 1/2] feat: add logic to capture target from wrapping anchor tag adapted to v1.x branch from 2a733b3 --- src/index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 20af02d..51b17c5 100644 --- a/src/index.js +++ b/src/index.js @@ -67,8 +67,15 @@ new PerformanceObserver((list) => list .observe({ type: 'navigation', buffered: true }); sampleRUM.targetselector = (element) => { - let value = element.getAttribute('data-rum-target') || element.getAttribute('href') || element.currentSrc || element.getAttribute('src') - || element.dataset.action || element.action; + const getTargetValue = (el) => el.getAttribute('data-rum-target') || el.getAttribute('href') + || el.currentSrc || el.getAttribute('src') + || el.dataset.action || el.action; + + let value = getTargetValue(element); + if (!value && element.tagName !== 'A' && element.closest('a')) { + value = getTargetValue(element.closest('a')); + } + if (value && !value.startsWith('https://')) { // resolve relative links value = new URL(value, window.location).href; From 1e876f22a3df0c942b9978e6c2e356c71c58c2e5 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Thu, 18 Apr 2024 10:17:38 +0000 Subject: [PATCH 2/2] chore(release): 1.15.0 [skip ci] # [1.15.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.14.0...v1.15.0) (2024-04-18) ### Features * add logic to capture target from wrapping anchor tag ([9f40d95](https://github.com/adobe/helix-rum-enhancer/commit/9f40d951021aa452b0cb8020c8ef1c2f5e68d069)) --- CHANGELOG.md | 7 +++++++ package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b7bc202..cefd8a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [1.15.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.14.0...v1.15.0) (2024-04-18) + + +### Features + +* add logic to capture target from wrapping anchor tag ([9f40d95](https://github.com/adobe/helix-rum-enhancer/commit/9f40d951021aa452b0cb8020c8ef1c2f5e68d069)) + # [1.14.0](https://github.com/adobe/helix-rum-enhancer/compare/v1.13.2...v1.14.0) (2024-04-16) diff --git a/package.json b/package.json index b598b8a..7e0bdbe 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@adobe/helix-rum-enhancer", - "version": "1.14.0", + "version": "1.15.0", "description": "Helix RUM Enhancer", "main": "src/index.js", "type": "module",