Truly independent web browser
LibWeb: Withhold a control's validity while nothing tests it
Andreas Klinge1019eafb528
diff --git a/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.cpp b/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.cppindex 1614801f687..fe1fe7caa37 100644--- a/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.cpp+++ b/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.cpp@@ -37,12 +37,15 @@ void invalidate_style_after_placeholder_shown_change(DOM::Element& element)// A control's validity is also its form's and its ancestor fieldsets': `:invalid` on a form is a// statement about the controls under it. Each element whose truth can have moved hears the state it// now has, which is what lets a change that moved nothing publish nothing.-static void record_validity_states(DOM::Element& element)+void record_validity_states(DOM::Element& element){// An element whose initial features are pending will publish its current state when those// features are recorded. Computing that state here would be discarded by the style engine.if (!can_record_element_state_change(element))return;+ // OPTIMIZATION: Checking a control's constraints is the cost of this, which a value set by script pays each time.+ if (element_validity_is_withheld(element))+ return;auto validity = SelectorMatching::element_validity_state(element);record_element_state_changed(element, PseudoClass::Valid, validity == SelectorMatching::ValidityState::Valid);diff --git a/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.h b/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.hindex e1494d32796..faea939152d 100644--- a/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.h+++ b/Libraries/LibWeb/CSS/Invalidation/FormControlInvalidator.h@@ -20,6 +20,9 @@ void invalidate_style_after_checked_state_change(DOM::Element&);void invalidate_style_after_placeholder_shown_change(DOM::Element&);void invalidate_style_after_validity_change(DOM::Element&);+// Publishes the validity the element now has, where something may read it.+void record_validity_states(DOM::Element&);+// A control leaving the tree takes its constraints with it, so the form and the fieldsets it was// under answer differently for `:valid`/`:invalid` without anything about them having moved. The// control is gone by the time this runs, so the containers are reached from where it was.diff --git a/Libraries/LibWeb/CSS/SelectorMatching.cpp b/Libraries/LibWeb/CSS/SelectorMatching.cppindex f9c5d363bfc..f2d82dbad6a 100644--- a/Libraries/LibWeb/CSS/SelectorMatching.cpp+++ b/Libraries/LibWeb/CSS/SelectorMatching.cpp@@ -182,7 +182,12 @@ static bool element_popover_is_open(DOM::Element const& element)X(OptimalValue, meter->value_state() == HTML::HTMLMeterElement::ValueState::Optimal) \X(SuboptimalValue, meter->value_state() == HTML::HTMLMeterElement::ValueState::Suboptimal)-CSS::PseudoClassBitmap element_states(DOM::Element const& element, AskLocalLink ask_local_link)+bool element_can_have_validity(DOM::Element const& element)+{+ return as_form_associated_element(element) || is<HTML::HTMLFormElement>(element) || is<HTML::HTMLFieldSetElement>(element);+}++CSS::PseudoClassBitmap element_states(DOM::Element const& element, AskLocalLink ask_local_link, AskValidity ask_validity){CSS::PseudoClassBitmap states;auto set = [&](CSS::PseudoClass pseudo_class, bool holds) {@@ -218,12 +223,14 @@ CSS::PseudoClassBitmap element_states(DOM::Element const& element, AskLocalLinkset(CSS::PseudoClass::Required, required == RequiredState::Required);set(CSS::PseudoClass::Optional, required == RequiredState::Optional);- auto user_validity = element_user_validity_state(element);- set(CSS::PseudoClass::UserValid, user_validity == ValidityState::Valid);- set(CSS::PseudoClass::UserInvalid, user_validity == ValidityState::Invalid);+ if (ask_validity == AskValidity::Yes) {+ auto user_validity = element_user_validity_state(element);+ set(CSS::PseudoClass::UserValid, user_validity == ValidityState::Valid);+ set(CSS::PseudoClass::UserInvalid, user_validity == ValidityState::Invalid);+ }}- if (form_associated_element || is<HTML::HTMLFormElement>(element) || is<HTML::HTMLFieldSetElement>(element)) {+ if (ask_validity == AskValidity::Yes && element_can_have_validity(element)) {auto validity = element_validity_state(element);set(CSS::PseudoClass::Valid, validity == ValidityState::Valid);set(CSS::PseudoClass::Invalid, validity == ValidityState::Invalid);diff --git a/Libraries/LibWeb/CSS/SelectorMatching.h b/Libraries/LibWeb/CSS/SelectorMatching.hindex c067a3297c4..4d57382eae1 100644--- a/Libraries/LibWeb/CSS/SelectorMatching.h+++ b/Libraries/LibWeb/CSS/SelectorMatching.h@@ -56,6 +56,12 @@ enum class AskLocalLink : u8 {No,Yes,};-WEB_API CSS::PseudoClassBitmap element_states(DOM::Element const&, AskLocalLink);+enum class AskValidity : u8 {+ No,+ Yes,+};+WEB_API CSS::PseudoClassBitmap element_states(DOM::Element const&, AskLocalLink, AskValidity);+// Whether `:valid`, `:invalid`, `:user-valid` or `:user-invalid` can hold of the element.+WEB_API bool element_can_have_validity(DOM::Element const&);}diff --git a/Libraries/LibWeb/CSS/StyleEngineBridge.cpp b/Libraries/LibWeb/CSS/StyleEngineBridge.cppindex fdc62f5bb61..524ea793217 100644--- a/Libraries/LibWeb/CSS/StyleEngineBridge.cpp+++ b/Libraries/LibWeb/CSS/StyleEngineBridge.cpp@@ -263,13 +263,17 @@ void StyleEngine::publish_html_element_namespace(StyleAtomID namespace_atom)StyleEngine::WithheldFeaturesNowRead StyleEngine::take_withheld_features_now_read(Layout::BegunRead const& read){WithheldFeaturesNowRead now_read;- if (!m_local_link_state_is_withheld && m_withheld_attribute_names.is_empty())+ if (!m_local_link_state_is_withheld && !m_validity_state_is_withheld && m_withheld_attribute_names.is_empty())return now_read;StyleEngineFFI::document_host_learn_selector_requirements(host(), &read);if (m_local_link_state_is_withheld && !local_link_is_known_untested()) {m_local_link_state_is_withheld = false;now_read.local_link_state = true;}+ if (m_validity_state_is_withheld && !validity_is_known_untested()) {+ m_validity_state_is_withheld = false;+ now_read.validity_state = true;+ }for (auto const& name : m_withheld_attribute_names) {if (!attribute_is_known_unread(intern_attribute_name(name.local_name, name.namespace_uri)))now_read.attributes.append(name);diff --git a/Libraries/LibWeb/CSS/StyleEngineBridge.h b/Libraries/LibWeb/CSS/StyleEngineBridge.hindex b91ce5704f7..e69606cac1c 100644--- a/Libraries/LibWeb/CSS/StyleEngineBridge.h+++ b/Libraries/LibWeb/CSS/StyleEngineBridge.h@@ -269,8 +269,13 @@ public:{return StyleEngineFFI::document_host_local_link_is_known_untested(host());}+ bool validity_is_known_untested() const+ {+ return StyleEngineFFI::document_host_validity_is_known_untested(host());+ }// What an element arrives with that the host knows nothing reads is withheld from the engine: whether a link is a- // local link where no selector tests `:local-link`, and each attribute no selector and no attr() reads. Each+ // local link where no selector tests `:local-link`, a control's validity where none tests that, and each attribute+ // no selector and no attr() reads. Each// withheld fact notes the element it was withheld from, so that once something may read it, it is published for// those elements alone.struct WithheldAttributeName {@@ -284,6 +289,7 @@ public:// NB: An element's identity may have been retired, or taken by another element, by the time a fact withheld from// it is published: what is published is read from whatever element holds the identity then.void note_local_link_state_withheld() { m_local_link_state_is_withheld = true; }+ void note_validity_state_withheld() { m_validity_state_is_withheld = true; }void note_attribute_withheld(Utf16FlyString const& local_name, Optional<Utf16FlyString> const& namespace_uri){m_withheld_attribute_names.set({ local_name, namespace_uri });@@ -292,6 +298,7 @@ public:// from.struct WithheldFeaturesNowRead {bool local_link_state { false };+ bool validity_state { false };Vector<WithheldAttributeName> attributes;};WithheldFeaturesNowRead take_withheld_features_now_read(Layout::BegunRead const&);@@ -473,6 +480,7 @@ private:Optional<u64> m_waiting_children_checked_against_keys_version;bool m_may_have_waiting_children { false };bool m_local_link_state_is_withheld { false };+ bool m_validity_state_is_withheld { false };HashTable<WithheldAttributeName, WithheldAttributeNameTraits> m_withheld_attribute_names;bool m_css_transitions_may_observe_style_changes { false };mutable bool m_geometry_read_deferred_transaction { false };diff --git a/Libraries/LibWeb/CSS/StyleEngineInput.cpp b/Libraries/LibWeb/CSS/StyleEngineInput.cppindex 066b95cdd4c..78a23ffa8b9 100644--- a/Libraries/LibWeb/CSS/StyleEngineInput.cpp+++ b/Libraries/LibWeb/CSS/StyleEngineInput.cpp@@ -16,6 +16,7 @@#include <LibWeb/CSS/CSSStyleRule.h>#include <LibWeb/CSS/CSSTransition.h>#include <LibWeb/CSS/ElementBoxKind.h>+#include <LibWeb/CSS/Invalidation/FormControlInvalidator.h>#include <LibWeb/CSS/Invalidation/LanguageInvalidator.h>#include <LibWeb/CSS/Invalidation/PseudoClassInvalidator.h>#include <LibWeb/CSS/Selector.h>@@ -1088,7 +1089,12 @@ static void publish_element_selector_features(StyleEngine& style_engine, DOM::Elask_local_link = SelectorMatching::AskLocalLink::No;style_engine.note_local_link_state_withheld();}- auto states = SelectorMatching::element_states(element, ask_local_link);+ auto ask_validity = SelectorMatching::AskValidity::Yes;+ if (SelectorMatching::element_can_have_validity(element) && style_engine.validity_is_known_untested()) {+ ask_validity = SelectorMatching::AskValidity::No;+ style_engine.note_validity_state_withheld();+ }+ auto states = SelectorMatching::element_states(element, ask_local_link, ask_validity);u64 state_bits = 0;states.for_each_set([&](PseudoClass pseudo_class) {// The engine's hover chain holds `:hover`, which the hover follows to an element that arrives hovered.@@ -1610,7 +1616,7 @@ void record_element_construction_facts(DOM::Element& element)void publish_withheld_element_features(StyleEngine& style_engine, StyleComputer& style_computer, Layout::BegunRead const& read){auto now_read = style_engine.take_withheld_features_now_read(read);- if (!now_read.local_link_state && now_read.attributes.is_empty())+ if (!now_read.local_link_state && !now_read.validity_state && now_read.attributes.is_empty())return;auto local_link = state_fact_for(PseudoClass::LocalLink);VERIFY(local_link.has_value());@@ -1630,6 +1636,8 @@ void publish_withheld_element_features(StyleEngine& style_engine, StyleComputer&auto node = element.style_node_id();if (now_read.local_link_state && element.matches_local_link_pseudo_class())style_engine.record_state_delta({ .node = node.value(), .fact = *local_link, .new_value = true });+ if (now_read.validity_state && SelectorMatching::element_can_have_validity(element))+ Invalidation::record_validity_states(element);for (auto const& [name, atom] : names_now_read) {if (auto value = element.get_attribute_ns(name.namespace_uri, name.local_name); value.has_value()) {style_engine.record_local_feature_delta({@@ -3159,6 +3167,15 @@ void record_stylesheet_detached(StyleSheetState& sheet, DOM::Node& document_or_s// inputs the engine already routes, not with a state transition published here.#include <LibWeb/StyleEngineStateFactsGenerated.inc>+bool element_validity_is_withheld(DOM::Element& element)+{+ auto* style_engine = style_engine_for(element);+ if (!style_engine || !style_engine->validity_is_known_untested())+ return false;+ style_engine->note_validity_state_withheld();+ return true;+}+bool can_record_element_state_change(DOM::Element& element){// A state an element waiting in a display:none subtree takes matters where a `:has()` argument may reach thediff --git a/Libraries/LibWeb/CSS/StyleEngineInput.h b/Libraries/LibWeb/CSS/StyleEngineInput.hindex 783c0c4d6e9..9436266a4dc 100644--- a/Libraries/LibWeb/CSS/StyleEngineInput.h+++ b/Libraries/LibWeb/CSS/StyleEngineInput.h@@ -166,6 +166,8 @@ WEB_API void record_element_emptiness_changed(DOM::Element&, DOM::Node const& ch// Called for each element whose pseudo-class state actually changed, with the value it changed to.// Only the states StyleEngine models as facts are recorded; the rest arrive when it models them.WEB_API bool can_record_element_state_change(DOM::Element&);+// Whether nothing reads the validity of the element, which notes it as withheld from the engine.+WEB_API bool element_validity_is_withheld(DOM::Element&);WEB_API void record_element_state_changed(DOM::Element&, PseudoClass, bool new_value);// Called before each style flush. The user-agent and user origins have no sheet list to announcediff --git a/Libraries/LibWeb/Rust/src/css/style/host_atoms.rs b/Libraries/LibWeb/Rust/src/css/style/host_atoms.rsindex 1486ba5a1b0..a4571cb4156 100644--- a/Libraries/LibWeb/Rust/src/css/style/host_atoms.rs+++ b/Libraries/LibWeb/Rust/src/css/style/host_atoms.rs@@ -364,6 +364,13 @@ pub extern "C" fn document_host_local_link_is_known_untested(host: &DocumentHosthost.known_selectors_test_local_link() == Some(false)}+/// Whether the host knows that no selector of the engine tests `:valid`, `:invalid`, `:user-valid` or `:user-invalid`,+/// which spares it checking the constraints of a control as its value moves.+#[unsafe(no_mangle)]+pub extern "C" fn document_host_validity_is_known_untested(host: &DocumentHost) -> bool {+ host.known_selectors_test_validity() == Some(false)+}+/// Whether the host knows that nothing of the engine reads the attribute name `name`: no selector tests it, by `name` or/// the other forms the host published with it, and no `attr()` reads it, by its local name if it has one. Where it does/// not know, the host hands the engine each change to the attribute.diff --git a/Libraries/LibWeb/Rust/src/css/style/inputs.rs b/Libraries/LibWeb/Rust/src/css/style/inputs.rsindex b17ea2bbf95..302b17f4897 100644--- a/Libraries/LibWeb/Rust/src/css/style/inputs.rs+++ b/Libraries/LibWeb/Rust/src/css/style/inputs.rs@@ -324,6 +324,7 @@ impl RetainedState {tested_attribute_names: self.tested_attribute_names.iter().copied().collect(),attribute_value_text_names: self.attribute_value_text_names.iter().copied().collect(),tests_local_link: self.selectors_test_local_link,+ tests_validity: self.selectors_test_validity,relational_arrival_keys: self.unresolved_relational_arrival_keys.iter().copied().collect(),}}@@ -331,6 +332,7 @@ impl RetainedState {/// Note what the selectors `summary` sums up test, which the engine's fact projection reads.pub(super) fn note_selector_summary(&mut self, summary: super::selector_analysis::SelectorSummary) {self.selectors_test_local_link |= summary.tests_local_link;+ self.selectors_test_validity |= summary.tests_validity;if !summary.tested_attribute_names.iter()@@ -415,6 +417,10 @@ impl RetainedState {self.selectors_test_local_link}+ pub(crate) fn selectors_test_validity(&self) -> bool {+ self.selectors_test_validity+ }+/// The attribute names a selector here tests in any way.pub(crate) fn selector_tested_attribute_names(&self) -> &SelectorAttributeNames {&self.tested_attribute_names@@ -1608,6 +1614,7 @@ impl StyleEngine {tested_attribute_names: Arc::default(),attribute_value_text_requirements_version: 0,selectors_test_local_link: false,+ selectors_test_validity: false,relational_arrival_keys: Arc::default(),unresolved_relational_arrival_keys: HashSet::default(),relational_arrival_keys_version: 0,@@ -2514,6 +2521,7 @@ impl RetainedState {tested_attribute_names: _,attribute_value_text_requirements_version: _,selectors_test_local_link: _,+ selectors_test_validity: _,relational_arrival_keys: _,unresolved_relational_arrival_keys: _,relational_arrival_keys_version: _,diff --git a/Libraries/LibWeb/Rust/src/css/style/mod.rs b/Libraries/LibWeb/Rust/src/css/style/mod.rsindex b2492bc7d4e..39913c4181c 100644--- a/Libraries/LibWeb/Rust/src/css/style/mod.rs+++ b/Libraries/LibWeb/Rust/src/css/style/mod.rs@@ -349,6 +349,7 @@ pub struct RetainedState {attribute_value_text_requirements_version: u64,/// Whether a selector tests `:local-link`, which the host holds a copy of between jobs.selectors_test_local_link: bool,+ selectors_test_validity: bool,/// What an arrival has to carry to reach a `:has()` anchor, which the host holds a copy of between jobs.relational_arrival_keys: Arc<RelationalArrivalKeys>,/// The keys rules added since, which the host learns of once they are resolved.diff --git a/Libraries/LibWeb/Rust/src/css/style/selector_analysis.rs b/Libraries/LibWeb/Rust/src/css/style/selector_analysis.rsindex 72b4379c8d8..2d39f86a8b2 100644--- a/Libraries/LibWeb/Rust/src/css/style/selector_analysis.rs+++ b/Libraries/LibWeb/Rust/src/css/style/selector_analysis.rs@@ -302,13 +302,14 @@ pub(super) fn dispatch_selectivity(key: DispatchKey) -> u8 {}/// What the host and the arrival routing ask of a document's selectors: the attribute names they-/// test, those whose values they read as text, whether they test `:local-link`, and what an element-/// arriving has to carry to reach the anchor of one of their `:has()`.+/// test, those whose values they read as text, whether they test `:local-link` or a control's validity, and what an+/// element arriving has to carry to reach the anchor of one of their `:has()`.#[derive(Clone, Default)]pub(in crate::css::style) struct SelectorSummary {pub(super) tested_attribute_names: Vec<StyleAtomID>,pub(super) attribute_value_text_names: Vec<StyleAtomID>,pub(super) tests_local_link: bool,+ pub(super) tests_validity: bool,pub(super) relational_arrival_keys: Vec<DispatchKey>,}@@ -431,6 +432,13 @@ impl SelectorSummary {kind => {if let Some(fact) = super::compiler::state_fact_for(kind) {self.tests_local_link |= fact == super::input_types::StateFact::LocalLink;+ self.tests_validity |= matches!(+ fact,+ super::input_types::StateFact::Valid+ | super::input_types::StateFact::Invalid+ | super::input_types::StateFact::UserValid+ | super::input_types::StateFact::UserInvalid+ );self.arrival_key(in_argument, DispatchKey::State(fact));}if reads_position(pseudo_class) {diff --git a/Libraries/LibWeb/Rust/src/render_state.rs b/Libraries/LibWeb/Rust/src/render_state.rsindex 162304d6a3d..bf25b26bffc 100644--- a/Libraries/LibWeb/Rust/src/render_state.rs+++ b/Libraries/LibWeb/Rust/src/render_state.rs@@ -193,6 +193,7 @@ impl RenderState {.selector_attribute_value_text_requirements_version(),relational_arrival_keys_version: engine.relational_arrival_keys_version(),selectors_test_local_link: engine.selectors_test_local_link(),+ selectors_test_validity: engine.selectors_test_validity(),};let selector_value_text_names = std::sync::Arc::clone(engine.selector_attribute_value_text_names());let selector_tested_attribute_names = std::sync::Arc::clone(engine.selector_tested_attribute_names());@@ -334,6 +335,7 @@ pub(crate) struct StateFacts {pub(crate) relational_arrival_keys_version: u64,/// Whether the engine's selectors test `:local-link`.pub(crate) selectors_test_local_link: bool,+ pub(crate) selectors_test_validity: bool,}/// What the style engine answers of itself as a job or a frame leaves it, which only a write to the engine moves (seediff --git a/Libraries/LibWeb/Rust/src/render_state/document_host.rs b/Libraries/LibWeb/Rust/src/render_state/document_host.rsindex 8f00ea7ba31..5a921c1a02e 100644--- a/Libraries/LibWeb/Rust/src/render_state/document_host.rs+++ b/Libraries/LibWeb/Rust/src/render_state/document_host.rs@@ -840,6 +840,13 @@ impl DocumentHost {.map(|facts| facts.selectors_test_local_link)}+ /// Whether the engine's selectors test a control's validity, where the host knows: as it knows where their+ /// requirements are.+ pub(crate) fn known_selectors_test_validity(&self) -> Option<bool> {+ self.facts_where(|moves| !moves.selectors)+ .map(|facts| facts.selectors_test_validity)+ }+/// Whether the engine's selectors test an attribute that answers to any of `keys`, where the host knows: as it knows/// where their requirements are.pub(crate) fn known_selectors_test_attribute(diff --git a/Tests/LibWeb/Text/expected/css/style-engine/validity-withheld-until-read.txt b/Tests/LibWeb/Text/expected/css/style-engine/validity-withheld-until-read.txtnew file mode 100644index 00000000000..fdd3e3ef35c--- /dev/null+++ b/Tests/LibWeb/Text/expected/css/style-engine/validity-withheld-until-read.txt@@ -0,0 +1,14 @@+before: rgb(0, 0, 0)+script reads input valid: true+script reads other invalid: true+script finds form invalid: true+arrived unread: rgb(0, 0, 0)+now read, input: rgb(1, 0, 0)+now read, other: rgb(2, 0, 0)+now read, arrived: rgb(2, 0, 0)+now read, form: rgb(3, 0, 0)+now read, fieldset: rgb(4, 0, 0)+now read, parent: rgb(5, 0, 0)+moved, input: rgb(2, 0, 0)+moved, fieldset: rgb(3, 0, 0)+moved, parent: rgb(0, 0, 0)diff --git a/Tests/LibWeb/Text/input/css/style-engine/validity-withheld-until-read.html b/Tests/LibWeb/Text/input/css/style-engine/validity-withheld-until-read.htmlnew file mode 100644index 00000000000..8cb16e7ff15--- /dev/null+++ b/Tests/LibWeb/Text/input/css/style-engine/validity-withheld-until-read.html@@ -0,0 +1,62 @@+<!DOCTYPE html>+<script src="../../include.js"></script>+<form id="form">+ <fieldset id="fieldset">+ <input id="input" required>+ </fieldset>+ <input id="other" required value="filled">+</form>+<div id="parent"><input id="inside" required></div>+<script>+ test(() => {+ const color = element => getComputedStyle(element).color;+ const form = document.getElementById("form");+ const fieldset = document.getElementById("fieldset");+ const input = document.getElementById("input");+ const other = document.getElementById("other");+ const parent = document.getElementById("parent");+ const inside = document.getElementById("inside");++ // Nothing tests a control's validity once this update is through.+ println(`before: ${color(input)}`);++ // What moves while nothing reads it, on elements that have arrived.+ other.value = "";+ input.value = "filled";+ inside.value = "filled";++ // Script asks of the element itself, whatever the style engine holds.+ println(`script reads input valid: ${input.matches(":valid")}`);+ println(`script reads other invalid: ${other.matches(":invalid")}`);+ println(`script finds form invalid: ${document.querySelector("form:invalid") === form}`);++ // A control arriving while nothing reads its validity.+ const arrived = document.createElement("input");+ arrived.required = true;+ form.appendChild(arrived);+ println(`arrived unread: ${color(arrived)}`);++ const style = document.createElement("style");+ style.textContent = `+ input:valid { color: rgb(1, 0, 0); }+ input:invalid { color: rgb(2, 0, 0); }+ form:invalid { color: rgb(3, 0, 0); }+ fieldset:valid { color: rgb(4, 0, 0); }+ div:has(:valid) { color: rgb(5, 0, 0); }+ `;+ document.head.appendChild(style);+ println(`now read, input: ${color(input)}`);+ println(`now read, other: ${color(other)}`);+ println(`now read, arrived: ${color(arrived)}`);+ println(`now read, form: ${color(form)}`);+ println(`now read, fieldset: ${color(fieldset)}`);+ println(`now read, parent: ${color(parent)}`);++ // Once read, a move shows at once.+ input.value = "";+ println(`moved, input: ${color(input)}`);+ println(`moved, fieldset: ${color(fieldset)}`);+ inside.value = "";+ println(`moved, parent: ${color(parent)}`);+ });+</script>