mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-01-24 10:12:25 -05:00
LibWeb: Implement cloning steps for HTMLTextAreaElement
This commit is contained in:
parent
71cfa705d1
commit
d3e076f963
Notes:
github-actions[bot]
2024-08-25 10:54:22 +00:00
Author: https://github.com/tcl3 Commit: https://github.com/LadybirdBrowser/ladybird/commit/d3e076f9637 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1185
4 changed files with 34 additions and 0 deletions
|
@ -0,0 +1 @@
|
|||
Cloned textarea value: PASS
|
|
@ -0,0 +1,20 @@
|
|||
<!DOCTYPE html>
|
||||
<script src="../include.js"></script>
|
||||
<form>
|
||||
<textarea id="testTextArea" value="FAIL"></textarea>
|
||||
</form>
|
||||
<script>
|
||||
test(() => {
|
||||
const form = document.forms[0];
|
||||
const textarea = form.querySelector("textarea");
|
||||
textarea.value = "PASS";
|
||||
|
||||
const clone = form.cloneNode(true);
|
||||
document.body.appendChild(clone);
|
||||
|
||||
println(`Cloned textarea value: ${clone.querySelector("textarea").value}`);
|
||||
|
||||
form.remove();
|
||||
clone.remove();
|
||||
});
|
||||
</script>
|
|
@ -116,6 +116,17 @@ void HTMLTextAreaElement::reset_algorithm()
|
|||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/forms.html#the-textarea-element:concept-node-clone-ext
|
||||
WebIDL::ExceptionOr<void> HTMLTextAreaElement::cloned(DOM::Node& copy, bool)
|
||||
{
|
||||
// The cloning steps for textarea elements must propagate the raw value and dirty value flag from the node being cloned to the copy.
|
||||
auto& textarea_copy = verify_cast<HTMLTextAreaElement>(copy);
|
||||
textarea_copy.m_raw_value = m_raw_value;
|
||||
textarea_copy.m_dirty_value = m_dirty_value;
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void HTMLTextAreaElement::form_associated_element_was_inserted()
|
||||
{
|
||||
create_shadow_tree_if_needed();
|
||||
|
|
|
@ -63,6 +63,8 @@ public:
|
|||
|
||||
virtual void reset_algorithm() override;
|
||||
|
||||
virtual WebIDL::ExceptionOr<void> cloned(Node&, bool) override;
|
||||
|
||||
virtual void form_associated_element_was_inserted() override;
|
||||
virtual void form_associated_element_was_removed(DOM::Node*) override;
|
||||
virtual void form_associated_element_attribute_changed(FlyString const&, Optional<String> const&) override;
|
||||
|
|
Loading…
Add table
Reference in a new issue