Source code
Revision control
Copy as Markdown
Other Tools
Test Info:
- This WPT test may be referenced by the following Test IDs:
- /css/selectors/invalidation/class-id-attr.html - WPT Dashboard Interop Dashboard
<!doctype html>
<meta charset="utf-8">
<title>CSS Test: [id] and [class] attribute selectors are invalidated correctly.</title>
<link rel="author" title="Emilio Cobos Álvarez" href="mailto:emilio@crisal.io">
<link rel="match" href="class-id-attr-ref.html">
<style>
[class="foo"] {
color: green;
}
[id="baz"] {
color: green;
}
</style>
<div id="foo">This should be green</div>
<div id="bar">And this too</div>
<script>
onload = function() {
document.documentElement.offsetTop;
foo.classList.add("foo");
bar.setAttribute("id", "baz");
document.documentElement.offsetTop;
}
</script>