4 Test for bug
1368240: We only invalidate style as little as needed
6 <link rel=
"author" href=
"mailto:emilio@crisal.io" title=
"Emilio Cobos Álvarez">
7 <script src=
"/tests/SimpleTest/SimpleTest.js"></script>
24 SimpleTest
.waitForExplicitFinish();
25 const utils
= SpecialPowers
.getDOMWindowUtils(window
);
27 // TODO(emilio): Add an API to get the ComputedStyles we've recreated, to make
28 // more elaborated tests.
29 document
.documentElement
.offsetTop
;
30 const initialRestyleGeneration
= utils
.restyleGeneration
;
32 // Normally we'd restyle the whole subtree in this case, but we should go down
33 // the tree invalidating as little as needed (nothing in this case).
34 container
.classList
.add("foo");
35 document
.documentElement
.offsetTop
;
36 is(utils
.restyleGeneration
, initialRestyleGeneration
,
37 "Shouldn't have restyled any descendant");
39 container
.setAttribute("id", "");
40 document
.documentElement
.offsetTop
;
41 is(utils
.restyleGeneration
, initialRestyleGeneration
,
42 "Shouldn't have restyled any sibling");