Skip to content

Commit 63cca19

Browse files
committed
fix(40454): update IDL url for Intersection Observer and add type map from undefined to void
1 parent 0d6f5b1 commit 63cca19

File tree

4 files changed

+15
-13
lines changed

4 files changed

+15
-13
lines changed

baselines/dom.generated.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ interface IntersectionObserverEntryInit {
611611
}
612612

613613
interface IntersectionObserverInit {
614-
root?: Element | null;
614+
root?: Element | Document | null;
615615
rootMargin?: string;
616616
threshold?: number | number[];
617617
}
@@ -9611,7 +9611,7 @@ declare var InputEvent: {
96119611

96129612
/** provides a way to asynchronously observe changes in the intersection of a target element with an ancestor element or with a top-level document's viewport. */
96139613
interface IntersectionObserver {
9614-
readonly root: Element | null;
9614+
readonly root: Node | null;
96159615
readonly rootMargin: string;
96169616
readonly thresholds: ReadonlyArray<number>;
96179617
disconnect(): void;

inputfiles/idl/Intersection Observer.widl

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
1-
callback IntersectionObserverCallback = void (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
1+
callback IntersectionObserverCallback = undefined (sequence<IntersectionObserverEntry> entries, IntersectionObserver observer);
22

3-
[Constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options),
4-
Exposed=Window]
3+
[Exposed=Window]
54
interface IntersectionObserver {
6-
readonly attribute Element? root;
5+
constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options = {});
6+
readonly attribute Node? root;
77
readonly attribute DOMString rootMargin;
88
readonly attribute FrozenArray<double> thresholds;
9-
void observe(Element target);
10-
void unobserve(Element target);
11-
void disconnect();
9+
undefined observe(Element target);
10+
undefined unobserve(Element target);
11+
undefined disconnect();
1212
sequence<IntersectionObserverEntry> takeRecords();
1313
};
1414

15-
[Constructor(IntersectionObserverEntryInit intersectionObserverEntryInit)]
15+
[Exposed=Window]
1616
interface IntersectionObserverEntry {
17+
constructor(IntersectionObserverEntryInit intersectionObserverEntryInit);
1718
readonly attribute DOMHighResTimeStamp time;
1819
readonly attribute DOMRectReadOnly? rootBounds;
1920
readonly attribute DOMRectReadOnly boundingClientRect;
@@ -34,7 +35,7 @@ dictionary IntersectionObserverEntryInit {
3435
};
3536

3637
dictionary IntersectionObserverInit {
37-
Element? root = null;
38+
(Element or Document)? root = null;
3839
DOMString rootMargin = "0px";
3940
(double or sequence<double>) threshold = 0;
4041
};

inputfiles/idlSources.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@
387387
"title": "Indexed Database"
388388
},
389389
{
390-
"url": "https://www.w3.org/TR/intersection-observer/",
390+
"url": "https://w3c.github.io/IntersectionObserver/",
391391
"title": "Intersection Observer"
392392
},
393393
{

src/helpers.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ export const baseTypeConversionMap = new Map<string, string>([
1616
["sequence", "Array"],
1717
["record", "Record"],
1818
["FrozenArray", "ReadonlyArray"],
19-
["EventHandler", "EventHandler"]
19+
["EventHandler", "EventHandler"],
20+
["undefined", "void"]
2021
]);
2122

2223
export function filter<T>(obj: T, fn: (o: any, n: string | undefined) => boolean): T {

0 commit comments

Comments
 (0)