IsHTMLDDA.cpp 1.0 KB

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (c) 2021-2023, Linus Groh <linusg@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibJS/Contrib/Test262/IsHTMLDDA.h>
  7. #include <LibJS/Runtime/GlobalObject.h>
  8. namespace JS::Test262 {
  9. IsHTMLDDA::IsHTMLDDA(Realm& realm)
  10. // NativeFunction without prototype is currently not possible (only due to the lack of a ctor that supports it)
  11. : NativeFunction("IsHTMLDDA", realm.intrinsics().function_prototype())
  12. {
  13. }
  14. ThrowCompletionOr<Value> IsHTMLDDA::call()
  15. {
  16. auto& vm = this->vm();
  17. if (vm.argument_count() == 0)
  18. return js_null();
  19. if (vm.argument(0).is_string() && vm.argument(0).as_string().is_empty())
  20. return js_null();
  21. // Not sure if this really matters, INTERPRETING.md simply says:
  22. // * IsHTMLDDA - (present only in implementations that can provide it) an object that:
  23. // a. has an [[IsHTMLDDA]] internal slot, and
  24. // b. when called with no arguments or with the first argument "" (an empty string) returns null.
  25. return js_undefined();
  26. }
  27. }