1 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://w3c.github.io/IntersectionObserver/
10 [ProbablyShortLivingWrapper, Exposed=Window]
11 interface IntersectionObserverEntry {
13 readonly attribute DOMHighResTimeStamp time;
15 readonly attribute DOMRectReadOnly? rootBounds;
17 readonly attribute DOMRectReadOnly boundingClientRect;
19 readonly attribute DOMRectReadOnly intersectionRect;
21 readonly attribute boolean isIntersecting;
23 readonly attribute double intersectionRatio;
25 readonly attribute Element target;
29 interface IntersectionObserver {
31 constructor(IntersectionCallback intersectionCallback,
32 optional IntersectionObserverInit options = {});
35 readonly attribute Node? root;
37 readonly attribute UTF8String rootMargin;
39 readonly attribute sequence<double> thresholds;
40 undefined observe(Element target);
41 undefined unobserve(Element target);
42 undefined disconnect();
43 sequence<IntersectionObserverEntry> takeRecords();
46 callback IntersectionCallback =
47 undefined (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
49 dictionary IntersectionObserverEntryInit {
50 required DOMHighResTimeStamp time;
51 required DOMRectInit rootBounds;
52 required DOMRectInit boundingClientRect;
53 required DOMRectInit intersectionRect;
54 required Element target;
57 dictionary IntersectionObserverInit {
58 (Element or Document)? root = null;
59 UTF8String rootMargin = "0px";
60 (double or sequence<double>) threshold = 0;