|
168 | 168 |
|
169 | 169 | <script id=dimensions> |
170 | 170 | const para = document.getElementById('para'); |
171 | | - testing.expectEqual(1, para.clientWidth); |
172 | | - testing.expectEqual(1, para.clientHeight); |
173 | | - |
174 | | - // let r1 = document.getElementById('para').getBoundingClientRect(); |
175 | | - // testing.expectEqual(0, r1.x); |
176 | | - // testing.expectEqual(0, r1.y); |
177 | | - // testing.expectEqual(1, r1.width); |
178 | | - // testing.expectEqual(2, r1.height); |
179 | | - |
180 | | - // let r2 = document.getElementById('content').getBoundingClientRect(); |
181 | | - // testing.expectEqual(1, r2.x); |
182 | | - // testing.expectEqual(0, r2.y); |
183 | | - // testing.expectEqual(1, r2.width); |
184 | | - // testing.expectEqual(1, r2.height); |
185 | | - |
186 | | - // let r3 = document.getElementById('para').getBoundingClientRect(); |
187 | | - // testing.expectEqual(0, r3.x); |
188 | | - // testing.expectEqual(0, r3.y); |
189 | | - // testing.expectEqual(1, r3.width); |
190 | | - // testing.expectEqual(1, r3.height); |
191 | | - |
192 | | - // testing.expectEqual(1, para.clientWidth); |
193 | | - // testing.expectEqual(1, para.clientHeight); |
194 | | - |
195 | | - // let r4 = document.createElement('div').getBoundingClientRect(); |
196 | | - // testing.expectEqual(0, r4.x); |
197 | | - // testing.expectEqual(0, r4.y); |
198 | | - // testing.expectEqual(0, r4.width); |
199 | | - // testing.expectEqual(0, r4.height); |
| 171 | + testing.expectEqual(5, para.clientWidth); |
| 172 | + testing.expectEqual(5, para.clientHeight); |
| 173 | + |
| 174 | + let r1 = document.getElementById('para').getBoundingClientRect(); |
| 175 | + testing.expectEqual(0, r1.x); |
| 176 | + testing.expectEqual(0, r1.y); |
| 177 | + testing.expectEqual(5, r1.width); |
| 178 | + testing.expectEqual(5, r1.height); |
| 179 | + |
| 180 | + let r2 = document.getElementById('content').getBoundingClientRect(); |
| 181 | + testing.expectEqual(5, r2.x); |
| 182 | + testing.expectEqual(0, r2.y); |
| 183 | + testing.expectEqual(5, r2.width); |
| 184 | + testing.expectEqual(5, r2.height); |
| 185 | + |
| 186 | + let r3 = document.getElementById('para').getBoundingClientRect(); |
| 187 | + testing.expectEqual(0, r3.x); |
| 188 | + testing.expectEqual(0, r3.y); |
| 189 | + testing.expectEqual(5, r3.width); |
| 190 | + testing.expectEqual(5, r3.height); |
| 191 | + |
| 192 | + testing.expectEqual(10, para.clientWidth); |
| 193 | + testing.expectEqual(5, para.clientHeight); |
| 194 | + |
| 195 | + let r4 = document.createElement('div').getBoundingClientRect(); |
| 196 | + testing.expectEqual(0, r4.x); |
| 197 | + testing.expectEqual(0, r4.y); |
| 198 | + testing.expectEqual(0, r4.width); |
| 199 | + testing.expectEqual(0, r4.height); |
200 | 200 | </script> |
201 | 201 |
|
202 | 202 | <script id=matches> |
|
0 commit comments