1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 14:27:35 +00:00

LibJS: Make Array constructor take its prototype

Let's start moving towards native JS objects taking their prototype as
a constructor argument.

This will eventually allow us to move prototypes off of Interpreter and
into GlobalObject.
This commit is contained in:
Andreas Kling 2020-04-17 18:24:01 +02:00
parent ee5816b9c8
commit 2d7b495244
7 changed files with 23 additions and 12 deletions

View file

@ -96,7 +96,7 @@ JS::Value DocumentWrapper::query_selector_all(JS::Interpreter& interpreter)
auto selector = arguments[0].to_string();
auto elements = document->query_selector_all(selector);
// FIXME: This should be a static NodeList, not a plain JS::Array.
auto* node_list = interpreter.heap().allocate<JS::Array>();
auto* node_list = JS::Array::create(interpreter.global_object());
for (auto& element : elements) {
node_list->elements().append(wrap(interpreter.heap(), element));
}