File: getClientRects-inline-with-block-child.html

package info (click to toggle)
firefox 149.0-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 4,767,760 kB
  • sloc: cpp: 7,416,064; javascript: 6,752,859; ansic: 3,774,850; python: 1,250,473; xml: 641,578; asm: 439,191; java: 186,617; sh: 56,634; makefile: 18,856; objc: 13,092; perl: 12,763; pascal: 5,960; yacc: 4,583; cs: 3,846; lex: 1,720; ruby: 1,002; php: 436; lisp: 258; awk: 105; sql: 66; sed: 53; csh: 10; exp: 6
file content (37 lines) | stat: -rw-r--r-- 1,193 bytes parent folder | download | duplicates (2)
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
27
28
29
30
31
32
33
34
35
36
37
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="help" href="https://drafts.csswg.org/cssom-view-1/#dom-element-getclientrects">
<link rel="author" title="Oriol Brufau" href="mailto:obrufau@igalia.com">

<section>
  <span id="target">
    <div style="height: 50px"></div>
  </span>
</section>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
function assert_rect_equals(actual, expected, description) {
  assert_equals(actual.x, expected.x, description + " - x");
  assert_equals(actual.y, expected.y, description + " - y");
  assert_equals(actual.width, expected.width, description + " - width");
  assert_equals(actual.height, expected.height, description + " - height");
}
test(() => {
  const target = document.getElementById("target");
  const rects = target.getClientRects();
  // TODO: check that it's exactly 3 fragments.
  assert_greater_than_equal(rects.length, 2, "At least 2 fragments");
  assert_rect_equals(
    rects[0],
    {x: 8, y: 8, width: 0, height: 0},
    "First rect",
  );
  assert_rect_equals(
    rects[rects.length - 1],
    {x: 8, y: 58, width: 0, height: 0},
    "Last rect",
  );
});
</script>