1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibWeb: Port MutationRecord from DeprecatedString to String

This commit is contained in:
Shannon Booth 2023-09-06 19:28:47 +12:00 committed by Andrew Kaster
parent 75133cf733
commit da1f137967
4 changed files with 24 additions and 12 deletions

View file

@ -1530,7 +1530,19 @@ void Node::queue_mutation_record(FlyString const& type, DeprecatedString attribu
for (auto& interested_observer : interested_observers) {
// 1. Let record be a new MutationRecord object with its type set to type, target set to target, attributeName set to name, attributeNamespace set to namespace, oldValue set to mappedOldValue,
// addedNodes set to addedNodes, removedNodes set to removedNodes, previousSibling set to previousSibling, and nextSibling set to nextSibling.
auto record = MutationRecord::create(realm(), type, *this, added_nodes_list, removed_nodes_list, previous_sibling, next_sibling, attribute_name, attribute_namespace, /* mappedOldValue */ interested_observer.value);
Optional<String> maybe_attribute_name;
if (!attribute_name.is_null())
maybe_attribute_name = MUST(String::from_deprecated_string(attribute_name));
Optional<String> maybe_attribute_namespace;
if (!attribute_namespace.is_null())
maybe_attribute_namespace = MUST(String::from_deprecated_string(attribute_namespace));
Optional<String> maybe_interested_observer;
if (!interested_observer.value.is_null())
maybe_interested_observer = MUST(String::from_deprecated_string(interested_observer.value));
auto record = MutationRecord::create(realm(), type, *this, added_nodes_list, removed_nodes_list, previous_sibling, next_sibling, maybe_attribute_name, maybe_attribute_namespace, /* mappedOldValue */ maybe_interested_observer);
// 2. Enqueue record to observers record queue.
interested_observer.key->enqueue_record({}, move(record));