Truly independent web browser
LibWeb: Do not fire input and change at an already checked radio
Andreas Kling3eb5e645f9e5
diff --git a/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Libraries/LibWeb/HTML/HTMLInputElement.cppindex d0255432ec8..e0b0b05f9e6 100644--- a/Libraries/LibWeb/HTML/HTMLInputElement.cpp+++ b/Libraries/LibWeb/HTML/HTMLInputElement.cpp@@ -490,6 +490,11 @@ WebIDL::ExceptionOr<void> HTMLInputElement::run_input_activation_behavior(DOM::Eif (!is_connected())return {};+ // INTEROP: Browsers do not fire input and change events at a radio button that was already checked before it+ // was activated.+ if (type_state() == TypeAttributeState::RadioButton && m_before_legacy_pre_activation_behavior_checked)+ return {};+// 2. Fire an event named input at the element with the bubbles and composed attributes initialized to true.auto input_event = create_event_for_element(*this, HTML::EventNames::input);input_event->set_bubbles(true);diff --git a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/radio-click-events.txt b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/radio-click-events.txtindex 71696846775..ba575e7c509 100644--- a/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/radio-click-events.txt+++ b/Tests/LibWeb/Text/expected/wpt-import/html/semantics/forms/the-input-element/radio-click-events.txt@@ -2,9 +2,8 @@ Harness status: OKFound 4 tests-3 Pass-1 Fail+4 PassPass radio input emits click, input, change events in order after synthetic clickPass radio input emits click, input, change events in order after dispatching click event-Fail checked radio input emits only click event on click+Pass checked radio input emits only click event on clickPass radio input synthetic click respects cancelling behaviour\ No newline at end of file