7 font-family: sans-serif;
12 font-family: workaround, monospace;
22 <p>For each input on the left, this table lists what happens when you
23 pass it into a CSS property and retrieve its value back. The third column
24 indicates whether the value was round-tripped faithfully.
</p>
31 if (window
.testRunner
)
32 testRunner
.dumpAsText();
34 var table
= document
.getElementById('table');
35 var div
= document
.getElementById('test');
37 function heading(text
) {
38 var tr
= document
.createElement('tr');
39 tr
.className
= 'heading';
40 var td
= document
.createElement('td');
43 td
.appendChild(document
.createTextNode(text
));
46 table
.appendChild(tr
);
49 function evaluate(code
) {
50 var result
= eval(code
);
51 var tr
= document
.createElement('tr');
53 var td
= document
.createElement('td');
54 var text
= document
.createElement('code');
55 text
.appendChild(document
.createTextNode(code
));
59 div
.style
.opacity
= eval(code
);
61 var td
= document
.createElement('td');
62 var text
= document
.createElement('code');
63 text
.appendChild(document
.createTextNode(div
.style
.opacity
));
67 var outValue
= div
.style
.opacity
;
68 // Test round-tripping
69 div
.style
.opacity
= 0;
70 div
.style
.opacity
= outValue
;
72 var td
= document
.createElement('td');
73 var text
= document
.createElement('span');
74 text
.appendChild(document
.createTextNode(outValue
== div
.style
.opacity
? "pass" : "fail"));
78 table
.appendChild(tr
);
81 heading("Basic floats");
84 evaluate("'123456.123456'");
85 evaluate("'1234567.1234567'");
86 evaluate("'12345678.12345678'");
88 heading("Trailing zeros");
89 evaluate("'0.00100000'");
90 evaluate("'0.001000001'");
91 evaluate("'0.12345000001'");
92 evaluate("'0.12304567'");
93 evaluate("'0.12340567'");
94 evaluate("'0.12345067'");
95 evaluate("'0.12345607'");
96 evaluate("'0.12345670'");
98 heading("Repeating decimals");
100 evaluate("123 + 1/3");
102 evaluate("123 + 13/99");
104 evaluate("123 + 100/999");
106 heading("Large numbers");
107 evaluate("12345678");
108 evaluate("123456789");
109 evaluate("1234567890");
110 evaluate("12345678901");
111 evaluate("123456789012");
112 evaluate("1234567890123");
113 evaluate("12345678901234");
114 evaluate("123456789012345");
115 evaluate("1234567890123456");
116 evaluate("12345678901234567");
118 heading("Weird numbers");
119 evaluate("Number.NaN");
121 evaluate("Math.sqrt(-1)");
122 evaluate("1/0.9999");
123 evaluate("1/0.99999");
124 evaluate("1/0.999999");
125 evaluate("1/0.9999999");
126 evaluate("1/0.99999999");