wpt / svg / types / scripted / SVGRect.html

Status: FAIL | Duration: 51ms | Subtests: 0/3 | Open test on wpt.live | wpt.fyi

Data from commit:
a50cb89 wpt: run reference-named files which are themselves tests (#836) (2026-09-03)

SubtestStatusMessage
SVGRect interface, initial valuesFAILnot a callable function
SVGRect interface, assignment, numeric valuesFAILnot a callable function
SVGRect interface, assignment, invalid valuesFAILnot a callable function

/svg/types/scripted/SVGRect.html

<!DOCTYPE html>
<title>SVGRect interface</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
  setup(() => {
    window.svgElement = document.createElementNS("http://www.w3.org/2000/svg", "svg");
  });

  test(t => {
    const rect = svgElement.createSVGRect();
    assert_equals(rect.x, 0, 'initial x');
    assert_equals(rect.y, 0, 'initial y');
    assert_equals(rect.width, 0, 'initial width');
    assert_equals(rect.height, 0, 'initial height');
  }, `${document.title}, initial values`);

  test(t => {
    const rect = svgElement.createSVGRect();
    rect.x = 100;
    rect.y = 200;
    rect.width = 300;
    rect.height = 400;
    assert_equals(rect.x, 100);
    assert_equals(rect.y, 200);
    assert_equals(rect.width, 300);
    assert_equals(rect.height, 400);

    rect.y = null;
    assert_equals(rect.y, 0);
  }, `${document.title}, assignment, numeric values`);

  test(t => {
    const rect = svgElement.createSVGRect();
    assert_throws_js(TypeError, () => { rect.x = rect; });
    assert_throws_js(TypeError, () => { rect.y = 'aString'; });
    assert_throws_js(TypeError, () => { rect.width = svgElement; });
    assert_throws_js(TypeError, () => { rect.height = NaN; });
  }, `${document.title}, assignment, invalid values`);
</script>