Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/cssom/style-backgroundcolor-table-row.html - WPT Dashboard Interop Dashboard
<!DOCTYPE html>
<title>CSSOM: Setting style.backgroundColor on table rows</title>
<meta charset="utf-8">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<table>
<thead>
<tr><th>Time</th></tr>
<tr><th>Customer Name</th></tr>
</thead>
<tbody>
<tr><td>...</td><td>Ricki</td></tr>
<tr><td>...</td><td>Ricki</td></tr>
<tr><td>...</td><td>Anna</td></tr>
</tbody>
</table>
<script>
"use strict";
test(() => {
const rows = document.querySelectorAll("tr");
for (const tr of rows) {
tr.style.backgroundColor = "pink";
assert_equals(tr.style.getPropertyValue("background-color"), "pink");
}
});
</script>