mirror of
https://github.com/SerenityOS/serenity
synced 2026-05-11 01:22:12 +02: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! :^)
21 lines
328 B
C++
21 lines
328 B
C++
#include <LibJS/PrimitiveString.h>
|
|
#include <LibJS/Value.h>
|
|
#include <LibWeb/Bindings/NodeWrapper.h>
|
|
#include <LibWeb/DOM/Node.h>
|
|
|
|
namespace Web {
|
|
namespace Bindings {
|
|
|
|
NodeWrapper::NodeWrapper(Node& node)
|
|
: m_node(node)
|
|
{
|
|
put("nodeName", JS::js_string(heap(), node.tag_name()));
|
|
}
|
|
|
|
NodeWrapper::~NodeWrapper()
|
|
{
|
|
}
|
|
|
|
}
|
|
}
|