LibWeb: Update the <textarea> shadow DOM when the value attribute is set

Otherwise, setting the value attribute after the element is added to the
DOM is not visibile. The logic here was stolen from the <input> element.
This commit is contained in:
Timothy Flynn 2024-03-14 07:37:25 -04:00 committed by Andreas Kling
commit abc1be5b9e
Notes: sideshowbarker 2024-07-17 20:33:50 +09:00
3 changed files with 33 additions and 6 deletions

View file

@ -5,6 +5,7 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 1 from TextNode start: 0, length: 1, rect: [254,8 10x22] baseline: 17
" "
frag 2 from BlockContainer start: 0, length: 0, rect: [267,11 240x44] baseline: 17
frag 3 from BlockContainer start: 0, length: 0, rect: [513,11 240x44] baseline: 17
TextNode <#text>
BlockContainer <textarea> at (11,11) content-size 240x44 inline-block [BFC] children: not-inline
BlockContainer <div> at (11,11) content-size 240x22 children: not-inline
@ -19,6 +20,12 @@ Viewport <#document> at (0,0) content-size 800x600 children: not-inline
frag 0 from TextNode start: 0, length: 19, rect: [267,11 177.6875x22] baseline: 17
"Well hello friends!"
TextNode <#text>
BlockContainer <textarea> at (513,11) content-size 240x44 inline-block [BFC] children: not-inline
BlockContainer <div> at (513,11) content-size 240x22 children: not-inline
BlockContainer <div> at (513,11) content-size 240x22 children: inline
frag 0 from TextNode start: 0, length: 16, rect: [513,11 154.0625x22] baseline: 17
"Tja hej vänner!"
TextNode <#text>
TextNode <#text>
ViewportPaintable (Viewport<#document>) [0,0 800x600]
@ -33,3 +40,7 @@ ViewportPaintable (Viewport<#document>) [0,0 800x600]
PaintableWithLines (BlockContainer<DIV>) [267,11 240x22]
PaintableWithLines (BlockContainer<DIV>) [267,11 240x22]
TextPaintable (TextNode<#text>)
PaintableWithLines (BlockContainer<TEXTAREA>) [510,8 246x50]
PaintableWithLines (BlockContainer<DIV>) [513,11 240x22]
PaintableWithLines (BlockContainer<DIV>) [513,11 240x22]
TextPaintable (TextNode<#text>)

View file

@ -5,7 +5,11 @@
</style></head><body>
<textarea>Bonjour mon amis!</textarea>
<script>
const textarea = document.createElement("textarea");
textarea.innerText = "Well hello friends!";
document.body.appendChild(textarea);
const textarea1 = document.createElement("textarea");
textarea1.innerText = "Well hello friends!";
document.body.appendChild(textarea1);
const textarea2 = document.createElement("textarea");
document.body.appendChild(textarea2);
textarea2.value = "Tja hej vänner!";
</script>