wpt / svg / styling / presentation-attributes-special-cases.html

Status: FAIL | Duration: 79ms | Subtests: 13/26 | 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
cx and cy presentation attributes supported on circle elementFAILassert_true: Presentation attribute cx="1" should be supported on circle element expected true got false
cx and cy presentation attributes supported on ellipse elementFAILassert_true: Presentation attribute cx="1" should be supported on ellipse element expected true got false
x, y, width, and height presentation attributes supported on foreignObject elementFAILassert_true: Presentation attribute x="1" should be supported on foreignObject element expected true got false
x, y, width, and height presentation attributes supported on image elementFAILassert_true: Presentation attribute x="1" should be supported on image element expected true got false
x, y, width, and height presentation attributes supported on rect elementFAILassert_true: Presentation attribute x="1" should be supported on rect element expected true got false
r presentation attribute supported on circle elementFAILassert_true: Presentation attribute r="1" should be supported on circle element expected true got false
rx and ry presentation attributes supported on ellipse elementFAILassert_true: Presentation attribute rx="1" should be supported on ellipse element expected true got false
rx and ry presentation attributes supported on rect elementFAILassert_true: Presentation attribute rx="1" should be supported on rect element expected true got false
d presentation attribute supported on path elementFAILassert_true: Presentation attribute d="M0,0 L1,1" should be supported on path element expected true got false
cx and cy presentation attributes not supported on other elementsPASS
x, y, width, and height presentation attributes not supported on other elementsPASS
r presentation attribute not supported on other elementsPASS
rx and ry presentation attributes not supported on other elementsPASS
d presentation attribute not supported on other elementsPASS
fill presentation attribute not supported on animatePASS
fill presentation attribute not supported on animateMotionPASS
fill presentation attribute not supported on animateTransformPASS
fill presentation attribute not supported on setPASS
transform presentation attribute supported on gFAILassert_true: Presentation attribute transform="scale(2)" should be supported on g element expected true got false
patternTransform presentation attribute supported on patternFAILassert_true: Presentation attribute patternTransform="scale(2)" should be supported on pattern element expected true got false
gradientTransform presentation attribute supported on linearGradientFAILassert_true: Presentation attribute gradientTransform="scale(2)" should be supported on linearGradient element expected true got false
gradientTransform presentation attribute supported on radialGradientFAILassert_true: Presentation attribute gradientTransform="scale(2)" should be supported on radialGradient element expected true got false
transform presentation attribute not supported on pattern or gradient elementsPASS
patternTransform presentation attribute not supported on g or gradient elementsPASS
gradientTransform presentation attribute not supported on g or pattern elementsPASS
width and height presentation attributes not supported on inner svg elementPASS

/svg/styling/presentation-attributes-special-cases.html

<!DOCTYPE html>
<meta charset="utf-8">
<title>SVG presentation attributes - special cases</title>
<link rel="help" href="https://w3c.github.io/svgwg/svg2-draft/styling.html#PresentationAttributes">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="presentation-attributes.js"></script>
<svg id="svg"></svg>
<script>
// 1. Test the special cases where presentation attributes are only allowed on
// a specific set of elements.

if (propertiesAreSupported(["cx", "cy"])) {
  for (let e of ["circle", "ellipse"]) {
    test(function() {
      for (let p of ["cx", "cy"]) {
        assertPresentationAttributeIsSupported(e, p, "1", p);
      }
    }, `cx and cy presentation attributes supported on ${e} element`);
  }
}

if (propertiesAreSupported(["x", "y", "width", "height"])) {
  for (let e of ["foreignObject", "image", "rect"]) {
    test(function() {
      for (let p of ["x", "y", "width", "height"]) {
        assertPresentationAttributeIsSupported(e, p, "1", p);
      }
    }, `x, y, width, and height presentation attributes supported on ${e} element`);
  }
}

if (CSS.supports("r", "initial")) {
  test(function() {
    assertPresentationAttributeIsSupported("circle", "r", "1", "r");
  }, `r presentation attribute supported on circle element`);
}

if (propertiesAreSupported(["rx", "ry"])) {
  for (let e of ["ellipse", "rect"]) {
    test(function() {
      for (let p of ["rx", "ry"]) {
        assertPresentationAttributeIsSupported(e, p, "1", p);
      }
    }, `rx and ry presentation attributes supported on ${e} element`);
  }
}

if (CSS.supports("d", "initial")) {
  test(function() {
    assertPresentationAttributeIsSupported("path", "d", "M0,0 L1,1", "d");
  }, `d presentation attribute supported on path element`);
}


// 2. Test that for those presentation attributes only allowed on a specific
// set of elements, that they are not supported on some other SVG element.
// (We use 'g' as that element for testing.)

if (propertiesAreSupported(["cx", "cy"])) {
  test(function() {
    for (let p of ["cx", "cy"]) {
      assertPresentationAttributeIsNotSupported("g", p, "1", p);
    }
  }, `cx and cy presentation attributes not supported on other elements`);
}

if (propertiesAreSupported(["x", "y", "width", "height"])) {
  test(function() {
    for (let p of ["x", "y", "width", "height"]) {
      assertPresentationAttributeIsNotSupported("g", p, "1", p);
    }
  }, `x, y, width, and height presentation attributes not supported on other elements`);
}

if (CSS.supports("r", "initial")) {
  test(function() {
    assertPresentationAttributeIsNotSupported("g", "r", "1", "r");
  }, `r presentation attribute not supported on other elements`);
}

if (propertiesAreSupported(["rx", "ry"])) {
  test(function() {
    for (let p of ["rx", "ry"]) {
      assertPresentationAttributeIsNotSupported("g", p, "1", p);
    }
  }, `rx and ry presentation attributes not supported on other elements`);
}

if (CSS.supports("d", "initial")) {
  test(function() {
    assertPresentationAttributeIsNotSupported("g", "d", "M0,0 L1,1", "d");
  }, `d presentation attribute not supported on other elements`);
}


// 3. Test that the fill presentation attribute is not supported on any
// animation elements.

if (CSS.supports("fill", "initial")) {
  for (let e of ["animate", "animateMotion", "animateTransform", "set"]) {
    test(function() {
      assertPresentationAttributeIsNotSupported(e, "fill", "blue", "fill");
    }, `fill presentation attribute not supported on ${e}`);
  }
}


if (CSS.supports("transform", "initial")) {
  // 4. Test support for the presentation attributes of the transform property,
  // which have a different spelling depending on which element they're on.

  test(function() {
    assertPresentationAttributeIsSupported("g", "transform", "scale(2)", "transform");
  }, `transform presentation attribute supported on g`);

  test(function() {
    assertPresentationAttributeIsSupported("pattern", "patternTransform", "scale(2)", "transform");
  }, `patternTransform presentation attribute supported on pattern`);

  for (let e of ["linearGradient", "radialGradient"]) {
    test(function() {
      assertPresentationAttributeIsSupported(e, "gradientTransform", "scale(2)", "transform");
    }, `gradientTransform presentation attribute supported on ${e}`);
  }


  // 5. Test that the wrong spellings of the presentation attributes of the
  // transform property are not supported.

  test(function() {
    for (let e of ["pattern", "linearGradient", "radialGradient"]) {
      assertPresentationAttributeIsNotSupported(e, "transform", "scale(2)", "transform");
    }
  }, `transform presentation attribute not supported on pattern or gradient elements`);

  test(function() {
    for (let e of ["g", "linearGradient", "radialGradient"]) {
      assertPresentationAttributeIsNotSupported(e, "patternTransform", "scale(2)", "transform");
    }
  }, `patternTransform presentation attribute not supported on g or gradient elements`);

  test(function() {
    for (let e of ["g", "pattern"]) {
      assertPresentationAttributeIsNotSupported(e, "gradientTransform", "scale(2)", "transform");
    }
  }, `gradientTransform presentation attribute not supported on g or pattern elements`);
}


// 6. Test that width and height presentation attributes are not supported
// on inner svg elements.
//
// https://github.com/w3c/svgwg/issues/1057
if (propertiesAreSupported(["width", "height"])) {
  test(function() {
    for (let p of ["width", "height"]) {
      assertPresentationAttributeIsNotSupported("svg", p, "1", p);
    }
  }, `width and height presentation attributes not supported on inner svg element`);
}
</script>