@adobe/helix-rum-enhancer 2.39.0 → 2.40.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [2.40.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.39.0...v2.40.0) (2025-07-29)
2
+
3
+
4
+ ### Features
5
+
6
+ * escape invalid/special characters from source selector ([#438](https://github.com/adobe/helix-rum-enhancer/issues/438)) ([#452](https://github.com/adobe/helix-rum-enhancer/issues/452)) ([6918ffa](https://github.com/adobe/helix-rum-enhancer/commit/6918ffaffd22d9c444a85815bc26bc8ebf655900))
7
+
1
8
  # [2.39.0](https://github.com/adobe/helix-rum-enhancer/compare/v2.38.0...v2.39.0) (2025-07-28)
2
9
 
3
10
 
package/modules/dom.js CHANGED
@@ -10,7 +10,7 @@
10
10
  * governing permissions and limitations under the License.
11
11
  */
12
12
  export const getTargetValue = (el) => el.getAttribute('data-rum-target') || el.getAttribute('href')
13
- || el.currentSrc || el.getAttribute('src') || el.dataset.action || el.action;
13
+ || el.currentSrc || el.getAttribute('src') || el.dataset.action || el.action;
14
14
 
15
15
  export const targetSelector = (el) => {
16
16
  try {
@@ -20,7 +20,7 @@ export const targetSelector = (el) => {
20
20
  v = getTargetValue(el.closest('a'));
21
21
  }
22
22
  if (v && !v.startsWith('https://')) {
23
- // resolve relative links
23
+ // resolve relative links
24
24
  v = new URL(v, window.location).href;
25
25
  }
26
26
  return v;
@@ -63,34 +63,34 @@ function getSourceContext(el) {
63
63
  if (formEl) {
64
64
  const id = formEl.getAttribute('id');
65
65
  if (id) {
66
- return `form#${id}`;
66
+ return `form#${CSS.escape(id)}`;
67
67
  }
68
- return `form${formEl.classList.length > 0 ? `.${formEl.classList[0]}` : ''}`;
68
+ return `form${formEl.classList.length > 0 ? `.${CSS.escape(formEl.classList[0])}` : ''}`;
69
69
  }
70
70
  const block = el.closest('.block[data-block-name]');
71
71
  return ((block && `.${block.getAttribute('data-block-name')}`)
72
72
  || (walk(el, isDialog) && 'dialog')
73
73
  || (walk(el, (e) => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()))
74
74
  || ['nav', 'header', 'footer', 'aside'].find((t) => el.closest(t))
75
- || walk(el, (e) => e.id && `#${e.id}`));
75
+ || walk(el, (e) => e.id && `#${CSS.escape(e.id)}`));
76
76
  }
77
77
 
78
78
  function getSourceElement(el) {
79
79
  const f = el.closest('form');
80
80
  if (f && Array.from(f.elements).includes(el)) {
81
81
  return (el.tagName.toLowerCase()
82
- + (['INPUT', 'BUTTON'].includes(el.tagName)
83
- ? `[type='${el.getAttribute('type') || ''}']`
84
- : ''));
82
+ + (['INPUT', 'BUTTON'].includes(el.tagName)
83
+ ? `[type='${el.getAttribute('type') || ''}']`
84
+ : ''));
85
85
  }
86
86
  if (walk(el, isButton)) return 'button';
87
87
  return el.tagName.toLowerCase().match(/^(a|img|video|form)$/) && el.tagName.toLowerCase();
88
88
  }
89
89
 
90
90
  function getSourceIdentifier(el) {
91
- if (el.id) return `#${el.id}`;
91
+ if (el.id) return `#${CSS.escape(el.id)}`;
92
92
  if (el.getAttribute('data-block-name')) return `.${el.getAttribute('data-block-name')}`;
93
- return (el.classList.length > 0 && `.${el.classList[0]}`);
93
+ return (el.classList.length > 0 && `.${CSS.escape(el.classList[0])}`);
94
94
  }
95
95
 
96
96
  export const sourceSelector = (el) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-rum-enhancer",
3
- "version": "2.39.0",
3
+ "version": "2.40.0",
4
4
  "description": "Helix RUM Enhancer",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -60,7 +60,7 @@
60
60
  "lint-staged": "16.1.2",
61
61
  "mocha": "11.7.1",
62
62
  "mocha-multi-reporters": "1.5.1",
63
- "rollup": "4.45.1",
63
+ "rollup": "4.46.1",
64
64
  "rollup-plugin-eslint-bundle": "9.0.0",
65
65
  "semantic-release": "24.2.7",
66
66
  "semantic-release-slack-bot": "^4.0.2",
package/src/index.js CHANGED
@@ -82,12 +82,12 @@
82
82
  if (formEl) {
83
83
  const id = formEl.getAttribute('id');
84
84
  if (id) {
85
- return `form#${id}`;
85
+ return `form#${CSS.escape(id)}`;
86
86
  }
87
- return `form${formEl.classList.length > 0 ? `.${formEl.classList[0]}` : ''}`;
87
+ return `form${formEl.classList.length > 0 ? `.${CSS.escape(formEl.classList[0])}` : ''}`;
88
88
  }
89
89
  const block = el.closest('.block[data-block-name]');
90
- return block && `.${block.getAttribute('data-block-name')}` || walk(el, isDialog) && 'dialog' || walk(el, e => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()) || ['nav', 'header', 'footer', 'aside'].find(t => el.closest(t)) || walk(el, e => e.id && `#${e.id}`);
90
+ return block && `.${block.getAttribute('data-block-name')}` || walk(el, isDialog) && 'dialog' || walk(el, e => e.tagName && e.tagName.includes('-') && e.tagName.toLowerCase()) || ['nav', 'header', 'footer', 'aside'].find(t => el.closest(t)) || walk(el, e => e.id && `#${CSS.escape(e.id)}`);
91
91
  }
92
92
  function getSourceElement(el) {
93
93
  const f = el.closest('form');
@@ -98,9 +98,9 @@
98
98
  return el.tagName.toLowerCase().match(/^(a|img|video|form)$/) && el.tagName.toLowerCase();
99
99
  }
100
100
  function getSourceIdentifier(el) {
101
- if (el.id) return `#${el.id}`;
101
+ if (el.id) return `#${CSS.escape(el.id)}`;
102
102
  if (el.getAttribute('data-block-name')) return `.${el.getAttribute('data-block-name')}`;
103
- return el.classList.length > 0 && `.${el.classList[0]}`;
103
+ return el.classList.length > 0 && `.${CSS.escape(el.classList[0])}`;
104
104
  }
105
105
  const sourceSelector = el => {
106
106
  try {
package/src/index.md5 CHANGED
@@ -1 +1 @@
1
- c69c2dbd6602a4f9ddaabfb336dbf6c3
1
+ 12d31296a6a7ae88c3e6f8545975c5ed
package/src/index.sri CHANGED
@@ -1 +1 @@
1
- sha384-I5K6alRMVQ/PEU4HdrN6eVdLhmFyFiprozg8vhN5h5gNbohsTdZ5JO5imnjM8Ccv
1
+ sha384-3VwEyTYUZI9gWm9M9J5acrD5Ub8kFjJ8DckCos5iDVXHKrJni6mlz9VV89dKwmWa
@@ -1 +1 @@
1
- ca3630c51ee48da2595696b4b11cb586
1
+ 411af2624f736f7385cfb1230be854c3
@@ -1 +1 @@
1
- c00518b019647f564ce00dce9d07c74b
1
+ 4b5cf6c41be188be11c519f419592e7e