summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/css3/calc/catch-divide-by-0.html
blob: 7a1a21bfcd085e9acfa7a53cea382a8db7b9a1c7 (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
25
26
<!DOCTYPE HTML>
<div id="dummy"></div>
<div id="results">This tests catching of divide by 0 in calc() at parse time<br><br></div>
<script>
if (window.testRunner)
    window.testRunner.dumpAsText();

var tests = [
    "100px / 0",
    "100px / (0)",
    "100px / (2 - 2)",
    "100px / (2 - (-62 + 64))",
    "100px * (1 / 0)",
    "100px * (1 / (0))",
    "100px * (1 / (2 - 2))",
    "100px * (1 / (2 - (-62 + 64)))",
];

var results = document.getElementById("results");
var dummy = document.getElementById("dummy");
for (var i = 0; i < tests.length; ++i) {
    var expression = tests[i];
    dummy.style.width = 'calc(' + expression + ')';
    results.innerHTML += expression + " => " + dummy.style.width + "<br>";
}
</script>