diff --git a/Tests/LibWeb/Text/expected/DOM/Document-methods-that-must-do-nothing.txt b/Tests/LibWeb/Text/expected/DOM/Document-methods-that-must-do-nothing.txt new file mode 100644 index 00000000000..b685894548e --- /dev/null +++ b/Tests/LibWeb/Text/expected/DOM/Document-methods-that-must-do-nothing.txt @@ -0,0 +1,3 @@ +document.clear() returns undefined: true +document.captureEvents() returns undefined: true +document.releaseEvents() returns undefined: true diff --git a/Tests/LibWeb/Text/input/DOM/Document-methods-that-must-do-nothing.html b/Tests/LibWeb/Text/input/DOM/Document-methods-that-must-do-nothing.html new file mode 100644 index 00000000000..b09fb63b5c7 --- /dev/null +++ b/Tests/LibWeb/Text/input/DOM/Document-methods-that-must-do-nothing.html @@ -0,0 +1,9 @@ + + + diff --git a/Userland/Libraries/LibWeb/DOM/Document.cpp b/Userland/Libraries/LibWeb/DOM/Document.cpp index 009efb50b48..99f96d1424a 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.cpp +++ b/Userland/Libraries/LibWeb/DOM/Document.cpp @@ -1472,6 +1472,24 @@ JS::NonnullGCPtr Document::all() return *m_all; } +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-clear +void Document::clear() +{ + // Do nothing +} + +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-captureevents +void Document::capture_events() +{ + // Do nothing +} + +// https://html.spec.whatwg.org/multipage/obsolete.html#dom-document-releaseevents +void Document::release_events() +{ + // Do nothing +} + Color Document::link_color() const { if (m_link_color.has_value()) diff --git a/Userland/Libraries/LibWeb/DOM/Document.h b/Userland/Libraries/LibWeb/DOM/Document.h index c49f757afc1..00a6b2bf8f2 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.h +++ b/Userland/Libraries/LibWeb/DOM/Document.h @@ -243,6 +243,10 @@ public: JS::NonnullGCPtr scripts(); JS::NonnullGCPtr all(); + void clear(); + void capture_events(); + void release_events(); + String const& source() const { return m_source; } void set_source(String source) { m_source = move(source); } diff --git a/Userland/Libraries/LibWeb/DOM/Document.idl b/Userland/Libraries/LibWeb/DOM/Document.idl index 584609ea87a..1753b027c27 100644 --- a/Userland/Libraries/LibWeb/DOM/Document.idl +++ b/Userland/Libraries/LibWeb/DOM/Document.idl @@ -78,6 +78,10 @@ interface Document : Node { readonly attribute HTMLAllCollection all; + undefined clear(); + undefined captureEvents(); + undefined releaseEvents(); + [CEReactions, NewObject] Element createElement(DOMString tagName, optional (DOMString or ElementCreationOptions) options = {}); [CEReactions, NewObject] Element createElementNS([FlyString] DOMString? namespace, DOMString qualifiedName, optional (DOMString or ElementCreationOptions) options = {}); DocumentFragment createDocumentFragment();