diff --git a/dom.bs b/dom.bs index 6d1870e89..1796d8ff1 100644 --- a/dom.bs +++ b/dom.bs @@ -4121,7 +4121,7 @@ dictionary MutationObserverInit { or omitted. -
observer . {{disconnect()}} +
observer . {{MutationObserver/disconnect()}}
Stops observer from observing any mutations. Until the {{observe()}} method is used again, observer's callback will not be invoked. @@ -8669,9 +8669,9 @@ be between 0 and the boundary point's node's
 [Exposed=Window]
 interface AbstractRange {
-  readonly attribute Node startContainer;
+  readonly attribute Node? startContainer;
   readonly attribute unsigned long startOffset;
-  readonly attribute Node endContainer;
+  readonly attribute Node? endContainer;
   readonly attribute unsigned long endOffset;
   readonly attribute boolean collapsed;
 };
@@ -8694,6 +8694,11 @@ interface AbstractRange {
 end offset is its end's
 offset.
 
+

A range has an associated is opaque +flag, initially false. When true, the {{AbstractRange/startContainer}} and +{{AbstractRange/endContainer}} getters return null. Only {{OpaqueRange}} objects have this flag set +to true. +

A range is collapsed if its start node is its end node and its start offset is its end offset. @@ -8719,7 +8724,8 @@ interface AbstractRange {

The startContainer -getter steps are to return this's start node. +getter steps are to return null if this's is opaque flag is true; otherwise +this's start node.

@@ -8729,7 +8735,8 @@ getter steps are to return this's start offset.

The endContainer -getter steps are to return this's end node. +getter steps are to return null if this's is opaque flag is true; otherwise +this's end node.

@@ -9981,6 +9988,96 @@ and {{Range/getBoundingClientRect()}} methods are defined in other specification [[CSSOM-VIEW]] +

Interface {{OpaqueRange}}

+ +
+[Exposed=Window]
+interface OpaqueRange : AbstractRange {
+  undefined disconnect();
+  DOMRectList getClientRects();
+  DOMRect getBoundingClientRect();
+};
+
+ +

Objects implementing the {{OpaqueRange}} interface are known as {{OpaqueRange}} objects. +{{OpaqueRange}} objects cannot be constructed directly; they are created by specifications defining +elements that support opaque ranges. + +

An {{OpaqueRange}} has an +associated element (an {{Element}} or null), initially null. It is +set by the specification that creates the {{OpaqueRange}}. + +

+
range . {{OpaqueRange/disconnect()}} +
Disconnects the range from its element and stops live updates. Afterwards, the range's + {{AbstractRange/startOffset}} and {{AbstractRange/endOffset}} are 0, and + {{OpaqueRange/getClientRects()}} and {{OpaqueRange/getBoundingClientRect()}} return empty results. + Calling this method on a range that is already disconnected has no effect. + +
rects = range . {{OpaqueRange/getClientRects()}} +
Returns a {{DOMRectList}} of client rectangles that enclose the selected portion of the range. + If the user agent cannot compute geometry for the range (e.g. because the element it was created + from is not connected or has computed display of none), or if the + range is {{AbstractRange/collapsed}} with no visible caret, returns an empty list. + +
rect = range . {{OpaqueRange/getBoundingClientRect()}} +
Returns a {{DOMRect}} that is the union of the rectangles from + {{OpaqueRange/getClientRects()}}. For a {{AbstractRange/collapsed}} range with a visible caret, + returns a rectangle of zero width whose height equals the line height at the caret position. If + the user agent cannot compute geometry for the range (e.g. because the element it was created + from is not connected or has computed display of none), returns + a rectangle with zero width and height. +
+ +
+

The disconnect() method steps are: + +

    +
  1. Let element be this's associated element. + +

  2. +

    If element is not null: + +

      +
    1. Run the opaque range disconnect steps given element and this. + +

    2. Set this's associated element to null. +

    + +
  3. Set this's start offset to 0. + +

  4. Set this's end offset to 0. +

+
+ +

The {{OpaqueRange/getClientRects()}} and {{OpaqueRange/getBoundingClientRect()}} methods are +defined in [[CSSOM-VIEW]]. + +

An {{OpaqueRange}} is a range whose is opaque flag is true. + +

An {{Element}} +supports opaque ranges if its specification defines that +it does. In HTML, this includes certain {{HTMLInputElement}} types and {{HTMLTextAreaElement}}. + +

Other specifications can designate additional elements, including custom elements. + +

An {{OpaqueRange}} is live, meaning its offsets are automatically updated when the underlying +content changes. Specifications that define elements supporting opaque ranges must specify: + +

    +
  • the internal container nodes used, + +

  • how {{OpaqueRange}} objects are created and detached, and + +

  • opaque range update steps to run when the underlying content changes + (e.g., when text is inserted or deleted). These steps should adjust offsets following the same + principles as the live range adjustments in the insert, remove, + replace data, and split algorithms. + +

  • opaque range disconnect steps, given an element and an + {{OpaqueRange}}, to run when {{OpaqueRange/disconnect()}} is called. +

+

Traversal