7 <script src=
"../../resources/js-test.js"></script>
9 <div id=
"target"></div>
12 description("Test that adding and removing class names with no matching selector does not cause a style recalc");
14 var target
= document
.getElementById('target');
16 function testClass(oldClasses
, newClasses
, needsRecalc
)
18 target
.className
= oldClasses
;
19 document
.body
.offsetTop
;
20 target
.className
= newClasses
;
21 shouldBe("internals.updateStyleAndReturnAffectedElementCount()", needsRecalc
? '1' : '0');
24 testClass('', 'exists1', true);
25 testClass('exists1', '', true);
26 testClass('', 'not-exists', false);
27 testClass('not-exists', '', false);
28 testClass('exists1', 'exists2', true);
29 testClass('exists1 exists2', 'exists2 exists1', false);
30 testClass('exists1 exists1', 'exists1 exists1', false);
31 testClass('exists1 exists1', 'exists1 exists1 doesnt-exist', false);
32 testClass('exists1 exists1 doesnt-exist', 'exists1 exists1', false);
33 testClass('exists1 exists1 doesnt-exist', 'exists1 doesnt-exist exists1', false);
34 testClass('exists1 doesnt-exist exists2 doesnt-exist exists1', 'doesnt-exist doesnt-exist2 exists2 exists1 doesnt-exist exists1', false);