From db35e88d6b9fdc094d78db971dac5402dd1e218b Mon Sep 17 00:00:00 2001 From: Mike Taylor Date: Fri, 1 Jul 2022 10:12:57 -0400 Subject: [PATCH] [cssom-view] Add a "get the bounding box" algorithm for getBoundingClientRect() This way other specs like IntersectionObserver can call it. --- cssom-view-1/Overview.bs | 24 +++++++++++++++--------- 1 file changed, 15 insertions(+), 9 deletions(-) diff --git a/cssom-view-1/Overview.bs b/cssom-view-1/Overview.bs index f98b01c014d..573a4b94bb5 100644 --- a/cssom-view-1/Overview.bs +++ b/cssom-view-1/Overview.bs @@ -1057,16 +1057,22 @@ The getClientRects() method, when invoked, must re Note: The {{DOMRect}} objects returned by {{Element/getClientRects()}} are not live. -The getBoundingClientRect() method, when invoked, must return the result of the following -algorithm: +The getBoundingClientRect() method, when +invoked on an element element, must return the result of +getting the bounding box for element. -1. Let list be the result of invoking {{Element/getClientRects()}} on the same element this method was invoked on. -1. If the list is empty return a {{DOMRect}} object - whose {{DOMRect/x}}, {{DOMRect/y}}, {{DOMRect/width}} and {{DOMRect/height}} members are zero. -1. If all rectangles in list have zero width or height, return the first rectangle in - list. -1. Otherwise, return a {{DOMRect}} object describing the smallest rectangle that includes all - of the rectangles in list of which the height or width is not zero. +
+To get the bounding box for element, +run the following steps: + 1. Let list be the result of invoking {{Element/getClientRects()}} on + element. + 1. If the list is empty return a {{DOMRect}} object whose {{DOMRect/x}}, + {{DOMRect/y}}, {{DOMRect/width}} and {{DOMRect/height}} members are zero. + 1. If all rectangles in list have zero width or height, return the first rectangle in + list. + 1. Otherwise, return a {{DOMRect}} object describing the smallest rectangle that includes all + of the rectangles in list of which the height or width is not zero. +
Note: The {{DOMRect}} object returned by {{Element/getBoundingClientRect()}} is not live.