Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / fast / css / class-name-no-matching-selector.html
blobc50b0fb915d9c4181bd00e960fd21df2abcaa58c
1 <!DOCTYPE html>
3 <style>
4 .exists1, .exists2 { }
5 </style>
7 <script src="../../resources/js-test.js"></script>
9 <div id="target"></div>
11 <script>
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);
35 </script>