* Fix serialization and mutation of <textarea> elements taking account the duality that the value can be set in either the child node, or in the value _parameter_ (not attribute)
* Backwards compatibility: Bug fix and regression test for #112
- this is to fix up 'historical' recordings, as duplicate textarea content should no longer be being created at record time
- new test shows what the snapshot generated by previous versions of rrweb used to look like, hence 'bad'
- original 0efe23f04a fix either didn't work or no longer works due to childNodes being appended subsequent to this part of the code
- during review, we also verified that the `_cssText` case should still be handled okay, as there's currently no scenario where csstext is present with css child nodes of a <style>
* Masking: Fix that textarea values were being missed by the masking system if the value was recorded as a child node
- I didn't notice that form.html was used in other tests, so lucky that I noticed that those tests also should have the 'pre value' masked out
* Simplify by always storing the textarea value in the `.value` attribute (from it's DOM property) and not as a childNode. It should still be rebuilt as a childNode rather than a property
---------
Authored-by: eoghanmurray <eoghan@getthere.ie>
45 lines
1.3 KiB
HTML
45 lines
1.3 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
|
|
<title>form fields</title>
|
|
</head>
|
|
|
|
<body>
|
|
<form>
|
|
<label for="text">
|
|
<input type="text" />
|
|
</label>
|
|
<label for="radio">
|
|
<input type="radio" />
|
|
</label>
|
|
<label for="checkbox">
|
|
<input type="checkbox" />
|
|
</label>
|
|
<label for="textarea">
|
|
<textarea name="" id="" cols="30" rows="10"></textarea>
|
|
<textarea name="" id="" cols="30" rows="10">-1</textarea>
|
|
</label>
|
|
<label for="select">
|
|
<select name="" id="">
|
|
<option value="1">1</option>
|
|
<option value="2">2</option>
|
|
</select>
|
|
</label>
|
|
<label>
|
|
<input name="tagName" />
|
|
</label>
|
|
</form>
|
|
</body>
|
|
<script>
|
|
document.querySelector('input[type="text"]').value = '1';
|
|
document.querySelector('input[type="radio"]').checked = true;
|
|
document.querySelector('input[type="checkbox"]').checked = true;
|
|
document.querySelector('textarea:empty').value = '1234';
|
|
document.querySelector('textarea:not(:empty)').value = '1234';
|
|
document.querySelector('select').value = '2';
|
|
</script>
|
|
</html>
|