bugfix: Sort attributes to make rr_* attributes handled last (#970)
* Sort attributes to make `rr_*` attributes handled last `rr_dataURL` overwrites `src` attribute, because of this we need to evaluate `rr_dataURL` last so it doesn't accidentally get overwritten again. * Update packages/rrweb-snapshot/src/rebuild.ts * Refactor handling of rr_* attributes Be a little more strict when it comes attribute types
This commit is contained in:
@@ -676,6 +676,7 @@ function serializeElementNode(
|
||||
// form fields
|
||||
if (tagName === 'input' || tagName === 'textarea' || tagName === 'select') {
|
||||
const value = (n as HTMLInputElement | HTMLTextAreaElement).value;
|
||||
const checked = (n as HTMLInputElement).checked;
|
||||
if (
|
||||
attributes.type !== 'radio' &&
|
||||
attributes.type !== 'checkbox' &&
|
||||
@@ -690,8 +691,8 @@ function serializeElementNode(
|
||||
maskInputOptions,
|
||||
maskInputFn,
|
||||
});
|
||||
} else if ((n as HTMLInputElement).checked) {
|
||||
attributes.checked = (n as HTMLInputElement).checked;
|
||||
} else if (checked) {
|
||||
attributes.checked = checked;
|
||||
}
|
||||
}
|
||||
if (tagName === 'option') {
|
||||
|
||||
Reference in New Issue
Block a user