mirror of
https://github.com/SerenityOS/serenity.git
synced 2025-01-23 18:02:05 -05:00
LibWeb: Don't proceed with Element.click() on disabled form controls
Fixes an infinite reload loop on some of the dom/events/ tests in WPT. (cherry picked from commit 273593afba71a42f1d760ac5b6664b77f74ffb7a)
This commit is contained in:
parent
ddefb5a822
commit
99a06079ce
3 changed files with 18 additions and 1 deletions
|
@ -0,0 +1 @@
|
|||
PASS! Did not click
|
|
@ -0,0 +1,12 @@
|
|||
<form id="theForm" style="display:none"><button id="theButton" type="submit" disabled></button></form>
|
||||
<script src="../include.js"></script>
|
||||
<script>
|
||||
theForm.onclick = function() {
|
||||
println("FAIL! Should not click!");
|
||||
}
|
||||
|
||||
test(() => {
|
||||
theButton.click();
|
||||
println("PASS! Did not click");
|
||||
});
|
||||
</script>
|
|
@ -464,7 +464,11 @@ JS::GCPtr<DOM::NodeList> HTMLElement::labels()
|
|||
// https://html.spec.whatwg.org/multipage/interaction.html#dom-click
|
||||
void HTMLElement::click()
|
||||
{
|
||||
// FIXME: 1. If this element is a form control that is disabled, then return.
|
||||
// 1. If this element is a form control that is disabled, then return.
|
||||
if (auto* form_control = dynamic_cast<FormAssociatedElement*>(this)) {
|
||||
if (!form_control->enabled())
|
||||
return;
|
||||
}
|
||||
|
||||
// 2. If this element's click in progress flag is set, then return.
|
||||
if (m_click_in_progress)
|
||||
|
|
Loading…
Add table
Reference in a new issue