mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:07:35 +00:00
LibWeb: Implement document ready state
This commit is contained in:
parent
8aabec1c94
commit
124c52b3b5
5 changed files with 49 additions and 0 deletions
|
@ -41,6 +41,7 @@
|
|||
#include <LibWeb/DOM/DocumentType.h>
|
||||
#include <LibWeb/DOM/Element.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/Text.h>
|
||||
#include <LibWeb/DOM/Window.h>
|
||||
#include <LibWeb/HTML/AttributeNames.h>
|
||||
|
@ -522,4 +523,10 @@ void Document::set_focused_element(Element* element)
|
|||
m_layout_root->set_needs_display();
|
||||
}
|
||||
|
||||
void Document::set_ready_state(const String& ready_state)
|
||||
{
|
||||
m_ready_state = ready_state;
|
||||
dispatch_event(Event::create("readystatechange"));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -174,6 +174,9 @@ public:
|
|||
const Document* associated_inert_template_document() const { return m_associated_inert_template_document; }
|
||||
void set_associated_inert_template_document(Document& document) { m_associated_inert_template_document = document; }
|
||||
|
||||
const String& ready_state() const { return m_ready_state; }
|
||||
void set_ready_state(const String&);
|
||||
|
||||
private:
|
||||
virtual RefPtr<LayoutNode> create_layout_node(const CSS::StyleProperties* parent_style) override;
|
||||
|
||||
|
@ -209,6 +212,8 @@ private:
|
|||
|
||||
bool m_created_for_appropriate_template_contents { false };
|
||||
RefPtr<Document> m_associated_inert_template_document;
|
||||
|
||||
String m_ready_state { "loading" };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -17,4 +17,6 @@ interface Document : Node {
|
|||
attribute HTMLElement? body;
|
||||
readonly attribute HTMLHeadElement? head;
|
||||
|
||||
readonly attribute DOMString readyState;
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue