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

LibWeb: Embrace Interpreter::{argument_count(), argument(index)}

This commit is contained in:
Linus Groh 2020-05-21 00:48:12 +01:00 committed by Andreas Kling
parent c00076de82
commit 2d503b20da
5 changed files with 42 additions and 55 deletions

View file

@ -75,10 +75,9 @@ JS::Value DocumentWrapper::get_element_by_id(JS::Interpreter& interpreter)
auto* document = document_from(interpreter);
if (!document)
return {};
auto& arguments = interpreter.call_frame().arguments;
if (arguments.is_empty())
if (!interpreter.argument_count())
return JS::js_null();
auto id = arguments[0].to_string(interpreter);
auto id = interpreter.argument(0).to_string(interpreter);
if (interpreter.exception())
return {};
auto* element = document->get_element_by_id(id);
@ -92,10 +91,9 @@ JS::Value DocumentWrapper::query_selector_all(JS::Interpreter& interpreter)
auto* document = document_from(interpreter);
if (!document)
return {};
auto& arguments = interpreter.call_frame().arguments;
if (arguments.is_empty())
if (!interpreter.argument_count())
return JS::js_null();
auto selector = arguments[0].to_string(interpreter);
auto selector = interpreter.argument(0).to_string(interpreter);
if (interpreter.exception())
return {};
auto elements = document->query_selector_all(selector);