mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-15 23:09:05 +00:00
LibWeb: Support Document.onreadystatechange
This is just a standard IDL event attribute handler. Fixes at least one WPT test: https://wpt.live/html/dom/documents/resource-metadata-management/document-readyState.html
This commit is contained in:
parent
de1475f99a
commit
26be8f865a
Notes:
github-actions[bot]
2024-10-08 16:50:11 +00:00
Author: https://github.com/awesomekling
Commit: 26be8f865a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/1683
5 changed files with 28 additions and 0 deletions
1
Tests/LibWeb/Text/expected/HTML/onreadystatechange.txt
Normal file
1
Tests/LibWeb/Text/expected/HTML/onreadystatechange.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
interactive
|
10
Tests/LibWeb/Text/input/HTML/onreadystatechange.html
Normal file
10
Tests/LibWeb/Text/input/HTML/onreadystatechange.html
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
<script src="../include.js"></script>
|
||||||
|
<script>
|
||||||
|
let readyStates = []
|
||||||
|
document.onreadystatechange = function() {
|
||||||
|
readyStates.push(document.readyState);
|
||||||
|
}
|
||||||
|
test(() => {
|
||||||
|
println(readyStates);
|
||||||
|
});
|
||||||
|
</script>
|
|
@ -5666,4 +5666,14 @@ Document::StepsToFireBeforeunloadResult Document::steps_to_fire_beforeunload(boo
|
||||||
return { unload_prompt_shown, unload_prompt_canceled };
|
return { unload_prompt_shown, unload_prompt_canceled };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
WebIDL::CallbackType* Document::onreadystatechange()
|
||||||
|
{
|
||||||
|
return event_handler_attribute(HTML::EventNames::readystatechange);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Document::set_onreadystatechange(WebIDL::CallbackType* value)
|
||||||
|
{
|
||||||
|
set_event_handler_attribute(HTML::EventNames::readystatechange, value);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -731,6 +731,9 @@ public:
|
||||||
};
|
};
|
||||||
StepsToFireBeforeunloadResult steps_to_fire_beforeunload(bool unload_prompt_shown);
|
StepsToFireBeforeunloadResult steps_to_fire_beforeunload(bool unload_prompt_shown);
|
||||||
|
|
||||||
|
[[nodiscard]] WebIDL::CallbackType* onreadystatechange();
|
||||||
|
void set_onreadystatechange(WebIDL::CallbackType*);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void initialize(JS::Realm&) override;
|
virtual void initialize(JS::Realm&) override;
|
||||||
virtual void visit_edges(Cell::Visitor&) override;
|
virtual void visit_edges(Cell::Visitor&) override;
|
||||||
|
|
|
@ -149,6 +149,10 @@ interface Document : Node {
|
||||||
boolean queryCommandState(DOMString commandId);
|
boolean queryCommandState(DOMString commandId);
|
||||||
boolean queryCommandSupported(DOMString commandId);
|
boolean queryCommandSupported(DOMString commandId);
|
||||||
DOMString queryCommandValue(DOMString commandId);
|
DOMString queryCommandValue(DOMString commandId);
|
||||||
|
|
||||||
|
// special event handler IDL attributes that only apply to Document objects
|
||||||
|
[LegacyLenientThis] attribute EventHandler onreadystatechange;
|
||||||
|
[FIXME] attribute EventHandler onvisibilitychange;
|
||||||
};
|
};
|
||||||
|
|
||||||
dictionary ElementCreationOptions {
|
dictionary ElementCreationOptions {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue