From 62847950783be6eae3c88147b934897c955599f7 Mon Sep 17 00:00:00 2001 From: Dmitry Kolupaev Date: Tue, 10 Mar 2020 00:07:00 +0300 Subject: [PATCH] Accept only connected attributes for checkbox and radio activation behaviour --- components/script/dom/htmlinputelement.rs | 3 +++ ...Event-dispatch-detached-input-and-change.html.ini | 12 ------------ 2 files changed, 3 insertions(+), 12 deletions(-) diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs index a5fefa095ae6..c27d5b2f9b54 100755 --- a/components/script/dom/htmlinputelement.rs +++ b/components/script/dom/htmlinputelement.rs @@ -2488,6 +2488,9 @@ impl Activatable for HTMLInputElement { // https://html.spec.whatwg.org/multipage/#checkbox-state-(type=checkbox):activation-behavior // https://html.spec.whatwg.org/multipage/#radio-button-state-(type=radio):activation-behavior // Check if document owner is fully active + if !self.upcast::().is_connected() { + return (); + } let target = self.upcast::(); target.fire_bubbling_event(atom!("input")); target.fire_bubbling_event(atom!("change")); diff --git a/tests/wpt/metadata/dom/events/Event-dispatch-detached-input-and-change.html.ini b/tests/wpt/metadata/dom/events/Event-dispatch-detached-input-and-change.html.ini index e4a330c1d27b..89105a799cd9 100644 --- a/tests/wpt/metadata/dom/events/Event-dispatch-detached-input-and-change.html.ini +++ b/tests/wpt/metadata/dom/events/Event-dispatch-detached-input-and-change.html.ini @@ -2,21 +2,9 @@ [attached to shadow dom radio should emit input and change events on click().] expected: FAIL - [detached checkbox should not emit input or change events on click().] - expected: FAIL - [attached to shadow dom checkbox should emit input and change events on click().] expected: FAIL - [detached radio should not emit input or change events on click().] - expected: FAIL - - [detached radio should not emit input or change events on dispatchEvent(new MouseEvent('click')).] - expected: FAIL - - [detached checkbox should not emit input or change events on dispatchEvent(new MouseEvent('click')).] - expected: FAIL - [attached to shadow dom checkbox should emit input and change events on dispatchEvent(new MouseEvent('click')).] expected: FAIL