Add the intersection-observer IDL file + test (#11858)
diff --git a/interfaces/intersection-observer.idl b/interfaces/intersection-observer.idl
new file mode 100644
index 0000000..83c5d90
--- /dev/null
+++ b/interfaces/intersection-observer.idl
@@ -0,0 +1,45 @@
+// GENERATED CONTENT - DO NOT EDIT
+// Content of this file was automatically extracted from the
+// "Intersection Observer" spec.
+// See: https://w3c.github.io/IntersectionObserver/
+
+callback IntersectionObserverCallback = void (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
+
+[Constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options),
+ Exposed=Window]
+interface IntersectionObserver {
+ readonly attribute Element? root;
+ readonly attribute DOMString rootMargin;
+ readonly attribute FrozenArray<double> thresholds;
+ void observe(Element target);
+ void unobserve(Element target);
+ void disconnect();
+ sequence<IntersectionObserverEntry> takeRecords();
+};
+
+[Constructor(IntersectionObserverEntryInit intersectionObserverEntryInit)]
+interface IntersectionObserverEntry {
+ readonly attribute DOMHighResTimeStamp time;
+ readonly attribute DOMRectReadOnly rootBounds;
+ readonly attribute DOMRectReadOnly boundingClientRect;
+ readonly attribute DOMRectReadOnly intersectionRect;
+ readonly attribute boolean isIntersecting;
+ readonly attribute double intersectionRatio;
+ readonly attribute Element target;
+};
+
+dictionary IntersectionObserverEntryInit {
+ required DOMHighResTimeStamp time;
+ required DOMRectInit rootBounds;
+ required DOMRectInit boundingClientRect;
+ required DOMRectInit intersectionRect;
+ required boolean isIntersecting;
+ required double intersectionRatio;
+ required Element target;
+};
+
+dictionary IntersectionObserverInit {
+ Element? root = null;
+ DOMString rootMargin = "0px";
+ (double or sequence<double>) threshold = 0;
+};
diff --git a/intersection-observer/idlharness.window.js b/intersection-observer/idlharness.window.js
new file mode 100644
index 0000000..2059e1c
--- /dev/null
+++ b/intersection-observer/idlharness.window.js
@@ -0,0 +1,22 @@
+// META: script=/resources/WebIDLParser.js
+// META: script=/resources/idlharness.js
+
+'use strict';
+
+// https://w3c.github.io/IntersectionObserver/
+
+idl_test(
+ ['intersection-observer'],
+ ['dom'],
+ idl_array => {
+ idl_array.add_objects({
+ IntersectionObserver: ['observer'],
+ });
+ var options = {
+ root: document.body,
+ rootMargin: '0px',
+ threshold: 1.0
+ }
+ self.observer = new IntersectionObserver(() => {}, options);
+ }
+);