summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/selectors/invalidation/class-id-attr.html
blob: 91a6f1a3a544bea376af2916b69a590bb0ac0a9a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<!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="help" href="https://drafts.csswg.org/selectors-4/#attribute-selectors">
<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>