fix: Ensure attributes are lowercased when checking (#1183)

* fix: Ensure attributes are lowercased when checking

* add changeset

* fix to lower case

* Apply formatting changes

---------

Co-authored-by: mydea <mydea@users.noreply.github.com>
This commit is contained in:
Francesco Novy
2026-04-01 12:00:00 +08:00
committed by GitHub
parent a539fd8f5b
commit ff54a2b097
6 changed files with 29 additions and 12 deletions

View File

@@ -9,6 +9,7 @@ import {
Mirror,
isNativeShadowDom,
getInputType,
toLowerCase,
} from 'rrweb-snapshot';
import type { observerParam, MutationBufferParam } from '../types';
import type {
@@ -597,8 +598,8 @@ export default class MutationBuffer {
// overwrite attribute if the mutations was triggered in same time
item.attributes[attributeName] = transformAttribute(
this.doc,
target.tagName,
attributeName,
toLowerCase(target.tagName),
toLowerCase(attributeName),
value,
);
}

View File

@@ -3,6 +3,7 @@ import {
maskInputValue,
Mirror,
getInputType,
toLowerCase,
} from 'rrweb-snapshot';
import type { FontFaceSet } from 'css-font-loading-module';
import {
@@ -309,13 +310,16 @@ function initMouseInteractionObserver({
disableMap[key] !== false,
)
.forEach((eventKey: keyof typeof MouseInteractions) => {
let eventName = eventKey.toLowerCase();
let eventName = toLowerCase(eventKey);
const handler = getHandler(eventKey);
if (window.PointerEvent) {
switch (MouseInteractions[eventKey]) {
case MouseInteractions.MouseDown:
case MouseInteractions.MouseUp:
eventName = eventName.replace('mouse', 'pointer');
eventName = eventName.replace(
'mouse',
'pointer',
) as unknown as typeof eventName;
break;
case MouseInteractions.TouchStart:
case MouseInteractions.TouchEnd:

View File

@@ -8,6 +8,7 @@ import {
createMirror,
attributes,
serializedElementNodeWithId,
toLowerCase,
} from 'rrweb-snapshot';
import {
RRDocument,
@@ -1120,7 +1121,7 @@ export class Replayer {
if (d.id === -1) {
break;
}
const event = new Event(MouseInteractions[d.type].toLowerCase());
const event = new Event(toLowerCase(MouseInteractions[d.type]));
const target = this.mirror.getNode(d.id);
if (!target) {
return this.debugNodeNotFound(d, d.id);