Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /svg/styling/attr-style-media.html - WPT Dashboard Interop Dashboard
<!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(() => {
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(() => {
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>