diff --git a/index.bs b/index.bs index f84443d..749c1e0 100644 --- a/index.bs +++ b/index.bs @@ -26,10 +26,10 @@ urlPrefix: https://html.spec.whatwg.org/multipage/ urlPrefix: dom.html url: #the-document-object; type:dfn; text: Document urlPrefix: browsers.html - type: dfn; text: unit of related similar-origin browsing contexts type: dfn; text: browsing context type: dfn; text: top-level browsing context - type: dfn; text: nested browsing contexts + type: dfn; text: nested browsing context + type: dfn; text: list of the descendant browsing contexts type: dfn; text: browsing context container type: dfn; text: fully active urlPrefix: webappapis.html; @@ -38,10 +38,14 @@ urlPrefix: https://html.spec.whatwg.org/multipage/ type: dfn; text: queue a task type: dfn; text: run the fullscreen rendering steps type: dfn; text: run the animation frame callbacks + type: dfn; text: relevant settings object url: #event-loop-processing-model; type: dfn; text: HTML Processing Model + url: #concept-environment-top-level-origin; type: dfn; text: top-level origin urlPrefix: infrastructure.html; type: dfn; text: rules for parsing dimension values url: #dfn-callback-this-value; type: dfn; text: callback this value + urlPrefix: origin.html + type: dfn; text: origin urlPrefix: https://heycam.github.io/webidl/ url: #dfn-simple-exception; type:exception; text: RangeError @@ -49,6 +53,7 @@ urlPrefix: https://heycam.github.io/webidl/ text: SyntaxError urlPrefix: #dfn-; type:dfn; text: throw urlPrefix: #idl-; type:interface; text: double + urlPrefix: #idl-; type:interface; text: undefined url: #hierarchyrequesterror; type: exception; text: HierarchyRequestError urlPrefix: https://drafts.csswg.org/css-box/ url: #containing-block; type: dfn; text: containing block @@ -170,15 +175,31 @@ The IntersectionObserver interface The {{IntersectionObserver}} interface can be used to observe changes in the intersection of an intersection root and one or more target {{Element}}s. -An {{IntersectionObserver}} with a {{IntersectionObserver/root}} {{Node}} can -observe any target {{Element}} that is a descendant of the +The intersection root +for an {{IntersectionObserver}} is the value of its {{IntersectionObserver/root}} attribute +if the attribute is non-null; +otherwise, it is the top-level browsing context's {{document}} node, +referred to as the implicit root. + +An {{IntersectionObserver}} with a non-null {{IntersectionObserver/root}} +is referred to as an explicit root observer, +and it can observe any target {{Element}} that is a descendant of the {{IntersectionObserver/root}} in the containing block chain. - -An {{IntersectionObserver}} with no {{IntersectionObserver/root}} {{Node}} -will automatically observe intersections with the implicit root, -and valid targets include any {{Element}} in the -top-level browsing context, as well as any {{Element}} in any -nested browsing contexts inside the top-level browsing context. +An {{IntersectionObserver}} with a null {{IntersectionObserver/root}} +is referred to as an implicit root observer. +Valid targets for an implicit root observer include +any {{Element}} in the top-level browsing context, +as well as any {{Element}} in any nested browsing context +which is in the list of the descendant browsing contexts of the top-level browsing context. + +When dealing with implicit root observers, the API makes a distinction between +a target whose relevant settings object's origin is +same origin-domain with the top-level origin, referred to as a +same-origin-domain target; +as opposed to a cross-origin-domain target. +Any target of an explicit root observer is also a same-origin-domain target, +since the target must be in the same document as the +intersection root. Note: In {{MutationObserver}}, the {{MutationObserverInit}} options are passed to {{MutationObserver/observe()}} while in {{IntersectionObserver}} they are @@ -187,11 +208,9 @@ being observed could have a different set of attributes to filter for. For {{IntersectionObserver}}, developers may choose to use a single observer to track multiple targets using the same set of options; or they may use a different observer for each tracked target. - {{IntersectionObserverInit/rootMargin}} or {{threshold}} values for each target seems to introduce more complexity without solving additional -use-cases. Per-{{observe()}} options could be provided in the future if V2 -introduces a need for it. +use-cases. Per-{{observe()}} options could be provided in the future if the need arises.
 [Exposed=Window]
@@ -278,9 +297,8 @@ interface IntersectionObserver {
 	::
 		Offsets applied to the root intersection rectangle,
 		effectively growing or shrinking the box that is used to calculate intersections.
-		Note that {{IntersectionObserver/rootMargin}} is only applied
-		for targets which belong to the same unit of related similar-origin browsing contexts
-		as the intersection root.
+		These offsets are only applied when handling same-origin-domain targets;
+		for cross-origin-domain targets they are ignored.
 
 		On getting, return the result of serializing the elements of {{[[rootMargin]]}}
 		space-separated, where pixel lengths serialize as the numeric value followed by "px",
@@ -299,18 +317,12 @@ interface IntersectionObserver {
 		{{IntersectionObserver}} constructor, the value of this attribute will be [0].
 
 
-The intersection root
-for an {{IntersectionObserver}} is the value of its {{IntersectionObserver/root}} attribute,
-or else the top-level browsing context's {{document}} node
-(referred to as the implicit root) if
-the {{IntersectionObserver/root}} attribute is null.
-
 The root intersection rectangle
 for an {{IntersectionObserver}}
 is the rectangle we'll use to check against the targets.
 
 
-
If the intersection root is the implicit root, +
If the {{IntersectionObserver}} is an implicit root observer,
it's treated as if the root were the top-level browsing context's {{document}}, according to the following rule for {{document}}.
If the intersection root is a {{document}}, @@ -323,9 +335,8 @@ is the rectangle we'll use to check against the targets.
it's the result of running the {{Element/getBoundingClientRect()}} algorithm on the intersection root.
-For any target which belongs to the same unit of related similar-origin browsing contexts -as the intersection root, -the rectangle is then expanded +When calculating the root intersection rectangle for +a same-origin-domain target, the rectangle is then expanded according to the offsets in the {{IntersectionObserver}}’s {{[[rootMargin]]}} slot in a manner similar to CSS's 'margin' property, with the four values indicating the amount the top, right, bottom, and left edges, respectively, are offset by, @@ -426,10 +437,7 @@ dictionary IntersectionObserverEntryInit { 1 if the {{IntersectionObserverEntry/isIntersecting}} is true, and 0 if not. : rootBounds :: - If {{IntersectionObserverEntry/target}} belongs to the same - unit of related similar-origin browsing contexts - as the intersection root, - this will be the root intersection rectangle. + For a same-origin-domain target, this will be the root intersection rectangle. Otherwise, this will be null. Note that if the target is in a different browsing context than the intersection root, this will be in a different coordinate system @@ -611,7 +619,7 @@ To run the update intersection observations steps for a 1. Let |observer list| be a list of all {{IntersectionObserver}}s whose {{IntersectionObserver/root}} is in the DOM tree of |document|. - For the top-level browsing context, this includes implicit root observers. + For the top-level browsing context, this includes implicit root observers. 2. For each |observer| in |observer list|: 1. Let |rootBounds| be |observer|'s root intersection rectangle. 2. For each |target| in |observer|'s internal {{[[ObservationTargets]]}} slot, processed in the same order that {{observe()}} was called on each |target|: @@ -684,7 +692,7 @@ A {{document}} is said to have pending initial IntersectionObserver targets if there is at least one {{IntersectionObserver}} meeting these criteria:
  1. The |observer|'s {{IntersectionObserver|root}} is in the |document| - (for the top-level browsing context, this includes implicit root observers). + (for the top-level browsing context, this includes implicit root observers).
  2. The |observer| has at least one |target| in its {{[[ObservationTargets]]}} slot for which no {{IntersectionObserverEntry}} has yet been queued.