wpt / svg / styling / attr-style-media.html

Status: FAIL | Duration: 50ms | 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
media attribute on SVG <style> elements should reflect correctlyFAILassert_equals: missing media reflects as empty string IDL attribute on the style element expected (string) "" but got (undefined) undefined
Setting media via the IDL attribute updates the content attributeFAILassert_equals: IDL setter writes to the content attribute expected (string) "print" but got (object) null
Setting the content attribute updates the IDL attribute (media)FAILassert_equals: IDL getter reflects the content attribute expected (string) "print" but got (undefined) undefined

/svg/styling/attr-style-media.html

<!DOCTYPE html>
<title>Media - SVG Style element</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>

<svg>
<style id=style1></style>
<style id=style2 media="foo"></style>
</svg>

<script>
  test(() => {
    assert_equals(style1.media, "", "missing media reflects as empty string IDL attribute on the style element");
    assert_equals(style2.media, "foo", "media reflects correctly IDL attribute on the style element");
  }, "media attribute on SVG <style> elements should reflect correctly");

  test(() => {
    const style = document.createElementNS("http://www.w3.org/2000/svg", "style");
    style.media = "print";
    assert_equals(style.media, "print",
                  "IDL setter round-trips through the IDL getter");
    assert_equals(style.getAttribute("media"), "print",
                  "IDL setter writes to the content attribute");
  }, "Setting media via the IDL attribute updates the content attribute");

  test(() => {
    const style = document.createElementNS("http://www.w3.org/2000/svg", "style");
    style.setAttribute("media", "print");
    assert_equals(style.media, "print",
                  "IDL getter reflects the content attribute");
  }, "Setting the content attribute updates the IDL attribute (media)");
</script>