LibWeb: Recreate the <input> shadow tree when the type attribute changes

This is often used on login forms, for example, to toggle the visibility
of a password. The site will change the <input> element's type to "text"
to allow the password to show.
This commit is contained in:
Timothy Flynn 2024-04-04 12:37:27 -04:00 committed by Andreas Kling
commit 0e774fe780
Notes: sideshowbarker 2024-07-17 01:46:43 +09:00
6 changed files with 67 additions and 1 deletions

View file

@ -0,0 +1,7 @@
<input type="password" value="hunter2" />
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
let input = document.querySelector("input");
input.type = "text";
});
</script>

View file

@ -0,0 +1,7 @@
<input type="text" value="hunter2" />
<script type="text/javascript">
document.addEventListener("DOMContentLoaded", () => {
let input = document.querySelector("input");
input.type = "password";
});
</script>