From b08845e49bd7267082e98ff834b6444d465391da Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 29 Jan 2019 10:56:25 +0900 Subject: [PATCH 1/2] partially revert Microsoft#625 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index dff6b56d3..cd97f9dde 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "private": true, "scripts": { "build": "tsc --p ./tsconfig.json && node ./lib/index.js", - "fetch-idl": "npm run build && node ./lib/idlfetcher.js", + "fetch-idl": "tsc --p ./tsconfig.json && node ./lib/idlfetcher.js", "fetch-mdn": "npm run build && node ./lib/mdnfetcher.js", "fetch": "echo This could take a few minutes... && npm run fetch-idl && npm run fetch-mdn", "baseline-accept": "cpx \"generated\\*\" baselines\\", From ab48d385a8d35aa0e3d5d88dee65d9a5e82d2c43 Mon Sep 17 00:00:00 2001 From: Kagami Sascha Rosylight Date: Tue, 5 Feb 2019 13:14:22 +0900 Subject: [PATCH 2/2] update Intersection Observer types --- baselines/dom.generated.d.ts | 7 ++-- inputfiles/idl/Intersection Observer.widl | 40 +++++++++++++++++++++++ inputfiles/idlSources.json | 4 +++ 3 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 inputfiles/idl/Intersection Observer.widl diff --git a/baselines/dom.generated.d.ts b/baselines/dom.generated.d.ts index 8fd89ce50..2b86364b1 100644 --- a/baselines/dom.generated.d.ts +++ b/baselines/dom.generated.d.ts @@ -535,9 +535,10 @@ interface IIRFilterOptions extends AudioNodeOptions { interface IntersectionObserverEntryInit { boundingClientRect: DOMRectInit; + intersectionRatio: number; intersectionRect: DOMRectInit; isIntersecting: boolean; - rootBounds: DOMRectInit; + rootBounds: DOMRectInit | null; target: Element; time: number; } @@ -9396,7 +9397,7 @@ declare var ImageData: { interface IntersectionObserver { readonly root: Element | null; readonly rootMargin: string; - readonly thresholds: number[]; + readonly thresholds: ReadonlyArray; disconnect(): void; observe(target: Element): void; takeRecords(): IntersectionObserverEntry[]; @@ -9414,7 +9415,7 @@ interface IntersectionObserverEntry { readonly intersectionRatio: number; readonly intersectionRect: ClientRect | DOMRect; readonly isIntersecting: boolean; - readonly rootBounds: ClientRect | DOMRect; + readonly rootBounds: ClientRect | DOMRect | null; readonly target: Element; readonly time: number; } diff --git a/inputfiles/idl/Intersection Observer.widl b/inputfiles/idl/Intersection Observer.widl new file mode 100644 index 000000000..3b1e6018c --- /dev/null +++ b/inputfiles/idl/Intersection Observer.widl @@ -0,0 +1,40 @@ +callback IntersectionObserverCallback = void (sequence entries, IntersectionObserver observer); + +[Constructor(IntersectionObserverCallback callback, optional IntersectionObserverInit options), + Exposed=Window] +interface IntersectionObserver { + readonly attribute Element? root; + readonly attribute DOMString rootMargin; + readonly attribute FrozenArray thresholds; + void observe(Element target); + void unobserve(Element target); + void disconnect(); + sequence 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) threshold = 0; +}; diff --git a/inputfiles/idlSources.json b/inputfiles/idlSources.json index 7cbcf47ec..6e4f22a30 100644 --- a/inputfiles/idlSources.json +++ b/inputfiles/idlSources.json @@ -194,6 +194,10 @@ "url": "https://www.w3.org/TR/IndexedDB-2/", "title": "Indexed Database" }, + { + "url": "https://www.w3.org/TR/intersection-observer/", + "title": "Intersection Observer" + }, { "url": "https://www.w3.org/TR/media-source/", "title": "Media Source Extensions"