Files
tannal 0c93332e68 Bug 2056206 [wpt PR 61406] - [mathml] Add WPT tests for attributeStyleMap on MathMLElement, a=testonly
Automatic update from web-platform-tests
[mathml] Add WPT tests for attributeStyleMap on MathMLElement

Bug: 527954011
Change-Id: I258de8455c422dc0aec2a8fb76b6964f721f9013
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/8010506
Reviewed-by: Stephen Chenney <schenney@chromium.org>
Commit-Queue: Frédéric Wang Nélar <fwang@igalia.com>
Reviewed-by: Frédéric Wang Nélar <fwang@igalia.com>
Cr-Commit-Position: refs/heads/main@{#1664605}

--

wpt-commits: 030897f81a3297054a93fd3aa0b40264419bf4f5
wpt-pr: 61406
2026-07-22 04:30:38 +00:00

40 lines
1.4 KiB
HTML

<!doctype html>
<meta charset="utf-8">
<title>MathMLElement attributeStyleMap getter for all elements</title>
<link rel="help" href="https://drafts.css-houdini.org/css-typed-om/#dom-elementcssinlinestyle-attributestylemap">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/mathml/support/mathml-fragments.js"></script>
<body>
</body>
<script>
for (const tag in MathMLFragments) {
document.body.insertAdjacentHTML("beforeend",
`<div style="display: block;"><math>${MathMLFragments[tag]}</math></div>`
);
let div = document.body.lastElementChild;
let element = FragmentHelper.element(div.firstElementChild);
test(function () {
element.style.color = 'rgb(0, 255, 0)';
element.style.fontSize = '20px';
let styleMap = element.attributeStyleMap;
assert_true(!!styleMap, `attributeStyleMap should exist on ${tag}`);
assert_true(styleMap.constructor.name.includes("StylePropertyMap"),
`attributeStyleMap should be an instance of StylePropertyMap on <${tag}>`);
assert_equals(styleMap.get('color').toString(), 'rgb(0, 255, 0)',
`attributeStyleMap.get('color') mismatch on <${tag}>`);
assert_equals(styleMap.get('font-size').toString(), '20px',
`attributeStyleMap.get('font-size') mismatch on <${tag}>`);
}, `attributeStyleMap getter on <${tag}>`);
div.style = "display: none;";
}
</script>