| 2150 |
mathias |
1 |
<html>
|
|
|
2 |
<!--
|
|
|
3 |
we use a quirks-mode DTD on purpose to ensure that things go tilt. Wheee!!
|
|
|
4 |
-->
|
|
|
5 |
<head>
|
|
|
6 |
<title>testing Core HTML/DOM/CSS/Style utils in quirks mode</title>
|
|
|
7 |
<style type="text/css">
|
|
|
8 |
@import "../../resources/dojo.css";
|
|
|
9 |
</style>
|
|
|
10 |
<script type="text/javascript"
|
|
|
11 |
src="../../dojo.js"
|
|
|
12 |
djConfig="isDebug: true"></script>
|
|
|
13 |
<script type="text/javascript">
|
|
|
14 |
dojo.require("doh.runner");
|
|
|
15 |
dojo.addOnLoad(function(){
|
|
|
16 |
doh.register("t",
|
|
|
17 |
[
|
|
|
18 |
"t.is(100, dojo.marginBox('sq100').w);",
|
|
|
19 |
"t.is(100, dojo.marginBox('sq100').h);",
|
|
|
20 |
|
|
|
21 |
"t.is(120, dojo.marginBox('sq100margin10').w);",
|
|
|
22 |
"t.is(120, dojo.marginBox('sq100margin10').h);",
|
|
|
23 |
"t.is(100, dojo.contentBox('sq100margin10').w);",
|
|
|
24 |
"t.is(100, dojo.contentBox('sq100margin10').h);",
|
|
|
25 |
|
|
|
26 |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge
|
|
|
27 |
//"t.is(100, dojo.marginBox('sq100nopos').w);",
|
|
|
28 |
"t.is(100, dojo.marginBox('sq100nopos').h);",
|
|
|
29 |
|
|
|
30 |
function coordsBasic(t){
|
|
|
31 |
var pos = dojo.coords("sq100", false);
|
|
|
32 |
// console.debug(pos);
|
|
|
33 |
t.is(100, pos.x);
|
|
|
34 |
t.is(100, pos.y);
|
|
|
35 |
t.is(100, pos.w);
|
|
|
36 |
t.is(100, pos.h);
|
|
|
37 |
},
|
|
|
38 |
function coordsMargin(t){
|
|
|
39 |
// coords is getting us the margin-box location, is
|
|
|
40 |
// this right?
|
|
|
41 |
var pos = dojo.coords("sq100margin10", false);
|
|
|
42 |
t.is(260, pos.x);
|
|
|
43 |
t.is(110, pos.y);
|
|
|
44 |
t.is(120, pos.w);
|
|
|
45 |
t.is(120, pos.h);
|
|
|
46 |
},
|
|
|
47 |
function sq100nopos(t){
|
|
|
48 |
var pos = dojo.coords("sq100nopos", false);
|
|
|
49 |
// console.debug(pos);
|
|
|
50 |
t.is(0, pos.x);
|
|
|
51 |
t.t(pos.y > 0);
|
|
|
52 |
// FIXME: the 'correct' w is not 100 on Safari WebKit (2.0.4 [419.3]), the right-margin extends to the document edge
|
|
|
53 |
//t.is(100, pos.w);
|
|
|
54 |
t.is(100, pos.h);
|
|
|
55 |
}
|
|
|
56 |
]
|
|
|
57 |
);
|
|
|
58 |
if(dojo.isIE){
|
|
|
59 |
// IE collapses padding in quirks mode. We just report on it.
|
|
|
60 |
doh.register("t",
|
|
|
61 |
[
|
|
|
62 |
"t.is(120, dojo.marginBox('sq100margin10pad10').w);",
|
|
|
63 |
"t.is(120, dojo.marginBox('sq100margin10pad10').h);",
|
|
|
64 |
|
|
|
65 |
"t.is(100, dojo.marginBox('sq100pad10').w);",
|
|
|
66 |
"t.is(100, dojo.marginBox('sq100pad10').h);",
|
|
|
67 |
|
|
|
68 |
"t.is(100, dojo.marginBox('sq100ltpad10').w);",
|
|
|
69 |
"t.is(100, dojo.marginBox('sq100ltpad10').h);",
|
|
|
70 |
"t.is(90, dojo.contentBox('sq100ltpad10').w);",
|
|
|
71 |
"t.is(90, dojo.contentBox('sq100ltpad10').h);",
|
|
|
72 |
|
|
|
73 |
"t.is(110, dojo.marginBox('sq100ltpad10rbmargin10').w);",
|
|
|
74 |
"t.is(110, dojo.marginBox('sq100ltpad10rbmargin10').h);",
|
|
|
75 |
|
|
|
76 |
"t.is(100, dojo.marginBox('sq100border10').w);",
|
|
|
77 |
"t.is(100, dojo.marginBox('sq100border10').h);",
|
|
|
78 |
"t.is(80, dojo.contentBox('sq100border10').w);",
|
|
|
79 |
"t.is(80, dojo.contentBox('sq100border10').h);",
|
|
|
80 |
|
|
|
81 |
"t.is(120, dojo.marginBox('sq100border10margin10').w);",
|
|
|
82 |
"t.is(120, dojo.marginBox('sq100border10margin10').h);",
|
|
|
83 |
"t.is(80, dojo.contentBox('sq100border10margin10').w);",
|
|
|
84 |
"t.is(80, dojo.contentBox('sq100border10margin10').h);",
|
|
|
85 |
|
|
|
86 |
"t.is(120, dojo.marginBox('sq100border10margin10pad10').w);",
|
|
|
87 |
"t.is(120, dojo.marginBox('sq100border10margin10pad10').h);",
|
|
|
88 |
"t.is(60, dojo.contentBox('sq100border10margin10pad10').w);",
|
|
|
89 |
"t.is(60, dojo.contentBox('sq100border10margin10pad10').h);"
|
|
|
90 |
]
|
|
|
91 |
);
|
|
|
92 |
}else{
|
|
|
93 |
doh.register("t",
|
|
|
94 |
[
|
|
|
95 |
"t.is(140, dojo.marginBox('sq100margin10pad10').w);",
|
|
|
96 |
"t.is(140, dojo.marginBox('sq100margin10pad10').h);",
|
|
|
97 |
|
|
|
98 |
"t.is(120, dojo.marginBox('sq100pad10').w);",
|
|
|
99 |
"t.is(120, dojo.marginBox('sq100pad10').h);",
|
|
|
100 |
|
|
|
101 |
"t.is(110, dojo.marginBox('sq100ltpad10').w);",
|
|
|
102 |
"t.is(110, dojo.marginBox('sq100ltpad10').h);",
|
|
|
103 |
"t.is(100, dojo.contentBox('sq100ltpad10').w);",
|
|
|
104 |
"t.is(100, dojo.contentBox('sq100ltpad10').h);",
|
|
|
105 |
|
|
|
106 |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').w);",
|
|
|
107 |
"t.is(120, dojo.marginBox('sq100ltpad10rbmargin10').h);",
|
|
|
108 |
|
|
|
109 |
"t.is(120, dojo.marginBox('sq100border10').w);",
|
|
|
110 |
"t.is(120, dojo.marginBox('sq100border10').h);",
|
|
|
111 |
"t.is(100, dojo.contentBox('sq100border10').w);",
|
|
|
112 |
"t.is(100, dojo.contentBox('sq100border10').h);",
|
|
|
113 |
|
|
|
114 |
"t.is(140, dojo.marginBox('sq100border10margin10').w);",
|
|
|
115 |
"t.is(140, dojo.marginBox('sq100border10margin10').h);",
|
|
|
116 |
"t.is(100, dojo.contentBox('sq100border10margin10').w);",
|
|
|
117 |
"t.is(100, dojo.contentBox('sq100border10margin10').h);",
|
|
|
118 |
|
|
|
119 |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').w);",
|
|
|
120 |
"t.is(160, dojo.marginBox('sq100border10margin10pad10').h);",
|
|
|
121 |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').w);",
|
|
|
122 |
"t.is(100, dojo.contentBox('sq100border10margin10pad10').h);"
|
|
|
123 |
]
|
|
|
124 |
);
|
|
|
125 |
}
|
|
|
126 |
|
|
|
127 |
doh.run();
|
|
|
128 |
});
|
|
|
129 |
</script>
|
|
|
130 |
<style type="text/css">
|
|
|
131 |
html, body {
|
|
|
132 |
padding: 0px;
|
|
|
133 |
margin: 0px;
|
|
|
134 |
border: 0px;
|
|
|
135 |
}
|
|
|
136 |
|
|
|
137 |
#sq100 {
|
|
|
138 |
background-color: black;
|
|
|
139 |
color: white;
|
|
|
140 |
position: absolute;
|
|
|
141 |
left: 100px;
|
|
|
142 |
top: 100px;
|
|
|
143 |
width: 100px;
|
|
|
144 |
height: 100px;
|
|
|
145 |
border: 0px;
|
|
|
146 |
padding: 0px;
|
|
|
147 |
margin: 0px;
|
|
|
148 |
overflow: hidden;
|
|
|
149 |
}
|
|
|
150 |
|
|
|
151 |
#sq100margin10 {
|
|
|
152 |
background-color: black;
|
|
|
153 |
color: white;
|
|
|
154 |
position: absolute;
|
|
|
155 |
left: 250px;
|
|
|
156 |
top: 100px;
|
|
|
157 |
width: 100px;
|
|
|
158 |
height: 100px;
|
|
|
159 |
border: 0px;
|
|
|
160 |
padding: 0px;
|
|
|
161 |
margin: 10px;
|
|
|
162 |
overflow: hidden;
|
|
|
163 |
}
|
|
|
164 |
|
|
|
165 |
#sq100margin10pad10 {
|
|
|
166 |
background-color: black;
|
|
|
167 |
color: white;
|
|
|
168 |
position: absolute;
|
|
|
169 |
left: 400px;
|
|
|
170 |
top: 100px;
|
|
|
171 |
width: 100px;
|
|
|
172 |
height: 100px;
|
|
|
173 |
border: 0px;
|
|
|
174 |
padding: 10px;
|
|
|
175 |
margin: 10px;
|
|
|
176 |
overflow: hidden;
|
|
|
177 |
}
|
|
|
178 |
|
|
|
179 |
#sq100pad10 {
|
|
|
180 |
background-color: black;
|
|
|
181 |
color: white;
|
|
|
182 |
position: absolute;
|
|
|
183 |
left: 100px;
|
|
|
184 |
top: 250px;
|
|
|
185 |
width: 100px;
|
|
|
186 |
height: 100px;
|
|
|
187 |
border: 0px;
|
|
|
188 |
padding: 10px;
|
|
|
189 |
margin: 0px;
|
|
|
190 |
overflow: hidden;
|
|
|
191 |
}
|
|
|
192 |
|
|
|
193 |
#sq100ltpad10 {
|
|
|
194 |
background-color: black;
|
|
|
195 |
color: white;
|
|
|
196 |
position: absolute;
|
|
|
197 |
left: 250px;
|
|
|
198 |
top: 250px;
|
|
|
199 |
width: 100px;
|
|
|
200 |
height: 100px;
|
|
|
201 |
border: 0px;
|
|
|
202 |
padding-left: 10px;
|
|
|
203 |
padding-top: 10px;
|
|
|
204 |
padding-right: 0px;
|
|
|
205 |
padding-bottom: 0px;
|
|
|
206 |
margin: 0px;
|
|
|
207 |
overflow: hidden;
|
|
|
208 |
}
|
|
|
209 |
|
|
|
210 |
#sq100ltpad10rbmargin10 {
|
|
|
211 |
background-color: black;
|
|
|
212 |
color: white;
|
|
|
213 |
position: absolute;
|
|
|
214 |
left: 400px;
|
|
|
215 |
top: 250px;
|
|
|
216 |
width: 100px;
|
|
|
217 |
height: 100px;
|
|
|
218 |
border: 0px;
|
|
|
219 |
padding-left: 10px;
|
|
|
220 |
padding-top: 10px;
|
|
|
221 |
padding-right: 0px;
|
|
|
222 |
padding-bottom: 0px;
|
|
|
223 |
margin-left: 0px;
|
|
|
224 |
margin-top: 0px;
|
|
|
225 |
margin-right: 10px;
|
|
|
226 |
margin-bottom: 10px;
|
|
|
227 |
overflow: hidden;
|
|
|
228 |
}
|
|
|
229 |
|
|
|
230 |
#sq100border10 {
|
|
|
231 |
background-color: black;
|
|
|
232 |
color: white;
|
|
|
233 |
position: absolute;
|
|
|
234 |
left: 100px;
|
|
|
235 |
top: 400px;
|
|
|
236 |
width: 100px;
|
|
|
237 |
height: 100px;
|
|
|
238 |
border: 10px solid yellow;
|
|
|
239 |
padding: 0px;
|
|
|
240 |
margin: 0px;
|
|
|
241 |
overflow: hidden;
|
|
|
242 |
}
|
|
|
243 |
|
|
|
244 |
#sq100border10margin10 {
|
|
|
245 |
background-color: black;
|
|
|
246 |
color: white;
|
|
|
247 |
position: absolute;
|
|
|
248 |
left: 250px;
|
|
|
249 |
top: 400px;
|
|
|
250 |
width: 100px;
|
|
|
251 |
height: 100px;
|
|
|
252 |
border: 10px solid yellow;
|
|
|
253 |
padding: 0px;
|
|
|
254 |
margin: 10px;
|
|
|
255 |
overflow: hidden;
|
|
|
256 |
}
|
|
|
257 |
|
|
|
258 |
#sq100border10margin10pad10 {
|
|
|
259 |
background-color: black;
|
|
|
260 |
color: white;
|
|
|
261 |
position: absolute;
|
|
|
262 |
left: 400px;
|
|
|
263 |
top: 400px;
|
|
|
264 |
width: 100px;
|
|
|
265 |
height: 100px;
|
|
|
266 |
border: 10px solid yellow;
|
|
|
267 |
padding: 10px;
|
|
|
268 |
margin: 10px;
|
|
|
269 |
overflow: hidden;
|
|
|
270 |
}
|
|
|
271 |
|
|
|
272 |
#sq100nopos {
|
|
|
273 |
background-color: black;
|
|
|
274 |
color: white;
|
|
|
275 |
width: 100px;
|
|
|
276 |
height: 100px;
|
|
|
277 |
padding: 0px;
|
|
|
278 |
margin: 0px;
|
|
|
279 |
}
|
|
|
280 |
|
|
|
281 |
</style>
|
|
|
282 |
</head>
|
|
|
283 |
<body>
|
|
|
284 |
<h1>testing Core HTML/DOM/CSS/Style utils</h1>
|
|
|
285 |
<div id="sq100">
|
|
|
286 |
100px square, abs
|
|
|
287 |
</div>
|
|
|
288 |
<div id="sq100margin10">
|
|
|
289 |
100px square, abs, 10px margin
|
|
|
290 |
</div>
|
|
|
291 |
<div id="sq100margin10pad10">
|
|
|
292 |
100px square, abs, 10px margin, 10px padding
|
|
|
293 |
</div>
|
|
|
294 |
<div id="sq100pad10">
|
|
|
295 |
100px square, abs, 10px padding
|
|
|
296 |
</div>
|
|
|
297 |
<div id="sq100ltpad10">
|
|
|
298 |
100px square, abs, 10px left and top padding
|
|
|
299 |
</div>
|
|
|
300 |
<div id="sq100ltpad10rbmargin10">
|
|
|
301 |
100px square, abs, 10px left and top padding, 10px bottom and right margin
|
|
|
302 |
</div>
|
|
|
303 |
<div id="sq100border10">
|
|
|
304 |
100px square, abs, 10px yellow border
|
|
|
305 |
</div>
|
|
|
306 |
<div id="sq100border10margin10">
|
|
|
307 |
100px square, abs, 10px yellow border, 10px margin
|
|
|
308 |
</div>
|
|
|
309 |
<div id="sq100border10margin10pad10">
|
|
|
310 |
100px square, abs, 10px yellow border, 10px margin, 10px padding
|
|
|
311 |
</div>
|
|
|
312 |
<div id="sq100nopos">
|
|
|
313 |
100px square, no positioning
|
|
|
314 |
</div>
|
|
|
315 |
</body>
|
|
|
316 |
</html>
|
|
|
317 |
|