Skip to content

armgit / moli

Public Imported from GitHub
0

Best headless browser for AI agents. Lite, Fast, High-Compatibility. Built in Rust

1.8 KB
Raw Blame
<!doctype html>
<meta charset="utf-8">
<script src="/wpt/resources/testharness.js"></script>
<script src="/wpt/resources/testharnessreport.js"></script>
<script src="/wpt/resources/moli-wpt-adapter.js"></script>
<script src="/wpt/resources/WebIDLParser.js"></script>
<script src="/wpt/resources/idlharness.js"></script>
<script>
idl_test([`
interface DOMRectReadOnly {
  readonly attribute unrestricted double top;
  readonly attribute unrestricted double right;
  readonly attribute unrestricted double bottom;
  readonly attribute unrestricted double left;
};

interface DOMRect : DOMRectReadOnly {
  constructor(optional unrestricted double x = 0, optional unrestricted double y = 0, optional unrestricted double width = 0, optional unrestricted double height = 0);
  attribute unrestricted double x;
  attribute unrestricted double y;
  attribute unrestricted double width;
  attribute unrestricted double height;
};
`], [], function (idlArray) {
  idlArray.enable_function_length_assertions();
  idlArray.enable_interface_descriptor_assertions();
  idlArray.enable_attribute_descriptor_assertions();
  idlArray.enable_object_brand_assertions();
  idlArray.add_objects({
    DOMRect: ["new DOMRect(1, 2, 3, 4)"]
  });
});

test(function () {
  const rect = new DOMRect(10, 20, -5, -7);
  assert_equals(rect.left, 5);
  assert_equals(rect.right, 10);
  assert_equals(rect.top, 13);
  assert_equals(rect.bottom, 20);
  rect.x = 3;
  rect.width = 9;
  assert_false(Object.prototype.hasOwnProperty.call(rect, "x"));
  assert_false(Object.prototype.hasOwnProperty.call(rect, "top"));
  assert_equals(rect.left, 3);
  assert_equals(rect.right, 12);
  assert_equals(Object.prototype.toString.call(rect), "[object DOMRect]");
}, "DOMRect idlharness sample exposes mutable dimensions and derived edges");
</script>