2018-09-13 23:04:55 +03:00
|
|
|
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2016-10-28 17:24:00 +03:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
|
|
|
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
|
|
*
|
|
|
|
* The origin of this IDL file is
|
2020-01-29 12:09:11 +03:00
|
|
|
* https://w3c.github.io/IntersectionObserver/
|
2016-10-28 17:24:00 +03:00
|
|
|
*/
|
|
|
|
|
2019-09-27 18:26:14 +03:00
|
|
|
[ProbablyShortLivingWrapper, Pref="dom.IntersectionObserver.enabled",
|
|
|
|
Exposed=Window]
|
2016-10-28 17:24:00 +03:00
|
|
|
interface IntersectionObserverEntry {
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMHighResTimeStamp time;
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMRectReadOnly? rootBounds;
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMRectReadOnly boundingClientRect;
|
|
|
|
[Constant]
|
|
|
|
readonly attribute DOMRectReadOnly intersectionRect;
|
|
|
|
[Constant]
|
2017-02-08 22:22:53 +03:00
|
|
|
readonly attribute boolean isIntersecting;
|
|
|
|
[Constant]
|
2016-10-28 17:24:00 +03:00
|
|
|
readonly attribute double intersectionRatio;
|
|
|
|
[Constant]
|
|
|
|
readonly attribute Element target;
|
|
|
|
};
|
|
|
|
|
2019-09-27 18:26:14 +03:00
|
|
|
[Pref="dom.IntersectionObserver.enabled",
|
|
|
|
Exposed=Window]
|
2016-10-28 17:24:00 +03:00
|
|
|
interface IntersectionObserver {
|
2019-09-12 14:01:17 +03:00
|
|
|
[Throws]
|
|
|
|
constructor(IntersectionCallback intersectionCallback,
|
|
|
|
optional IntersectionObserverInit options = {});
|
|
|
|
|
2016-10-28 17:24:00 +03:00
|
|
|
[Constant]
|
2020-03-03 15:25:30 +03:00
|
|
|
readonly attribute Node? root;
|
2016-10-28 17:24:00 +03:00
|
|
|
[Constant]
|
2020-12-17 17:04:35 +03:00
|
|
|
readonly attribute UTF8String rootMargin;
|
2016-10-28 17:24:00 +03:00
|
|
|
[Constant,Cached]
|
|
|
|
readonly attribute sequence<double> thresholds;
|
|
|
|
void observe(Element target);
|
|
|
|
void unobserve(Element target);
|
|
|
|
void disconnect();
|
|
|
|
sequence<IntersectionObserverEntry> takeRecords();
|
|
|
|
};
|
|
|
|
|
|
|
|
callback IntersectionCallback =
|
|
|
|
void (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
|
|
|
|
|
|
|
|
dictionary IntersectionObserverEntryInit {
|
|
|
|
required DOMHighResTimeStamp time;
|
|
|
|
required DOMRectInit rootBounds;
|
|
|
|
required DOMRectInit boundingClientRect;
|
|
|
|
required DOMRectInit intersectionRect;
|
|
|
|
required Element target;
|
|
|
|
};
|
|
|
|
|
|
|
|
dictionary IntersectionObserverInit {
|
2020-12-17 17:04:35 +03:00
|
|
|
(Element or Document)? root = null;
|
|
|
|
UTF8String rootMargin = "0px";
|
2016-10-28 17:24:00 +03:00
|
|
|
(double or sequence<double>) threshold = 0;
|
|
|
|
};
|