mirror of
https://github.com/RGBCube/serenity
synced 2025-05-28 04:15:07 +00:00

This patch introduces the Wrapper and Wrappable classes. Node now inherits from Wrappable, and can be wrapped in a GC-allocated Bindings::NodeWrapper object. The only property we expose right now is the very simple nodeName property. When a Document's JS::Interpreter is first instantiated, we add a "document" property with a DocumentWrapper object to the global object. This is pretty cool! :^)
29 lines
516 B
C++
29 lines
516 B
C++
#include <LibJS/PrimitiveString.h>
|
|
#include <LibJS/Value.h>
|
|
#include <LibWeb/Bindings/DocumentWrapper.h>
|
|
#include <LibWeb/DOM/Document.h>
|
|
|
|
namespace Web {
|
|
namespace Bindings {
|
|
|
|
DocumentWrapper::DocumentWrapper(Document& document)
|
|
: NodeWrapper(document)
|
|
{
|
|
}
|
|
|
|
DocumentWrapper::~DocumentWrapper()
|
|
{
|
|
}
|
|
|
|
Document& DocumentWrapper::node()
|
|
{
|
|
return static_cast<Document&>(NodeWrapper::node());
|
|
}
|
|
|
|
const Document& DocumentWrapper::node() const
|
|
{
|
|
return static_cast<const Document&>(NodeWrapper::node());
|
|
}
|
|
|
|
}
|
|
}
|