From 7763b01d6f597e97673d4258ec2d26fd4295341d Mon Sep 17 00:00:00 2001 From: "Queen Vinyl Da.i'gyu-Kazotetsu" Date: Tue, 22 Feb 2022 03:41:16 -0800 Subject: [PATCH] Adapt api.Document.onvisibilitychange to new events structure This PR adapts the visibilitychange event of the Document API to conform to the new events structure. --- api/Document.json | 218 ++++++++++++++++++++++++---------------------- 1 file changed, 114 insertions(+), 104 deletions(-) diff --git a/api/Document.json b/api/Document.json index a2dc5d06f74ab8..60a562dc0f01d7 100644 --- a/api/Document.json +++ b/api/Document.json @@ -7398,73 +7398,6 @@ } } }, - "onvisibilitychange": { - "__compat": { - "mdn_url": "https://developer.mozilla.org/docs/Web/API/Document/onvisibilitychange", - "spec_url": "https://html.spec.whatwg.org/multipage/webappapis.html#handler-onvisibilitychange", - "support": { - "chrome": { - "version_added": "62", - "notes": "Before Chrome 62, this event handler attribute is not supported; however, the event itself is supported since Chrome 33. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "chrome_android": { - "version_added": "62", - "notes": "Before Chrome 62, this event handler attribute is not supported; however, the event itself is supported since Chrome 33. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "edge": { - "version_added": "18", - "notes": "Before Edge 18, this event handler attribute was not supported; however, the event itself was supported since Edge 12. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "firefox": { - "version_added": "56" - }, - "firefox_android": { - "version_added": "56" - }, - "ie": { - "version_added": false, - "notes": "This event handler attribute is not supported; however, the event itself is supported since IE 10. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "opera": { - "version_added": "49", - "notes": "Before Opera 49, this event handler attribute is not supported; however, the event itself is supported since Opera 20. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "opera_android": { - "version_added": "46", - "notes": "Before Opera Android 46, this event handler attribute is not supported; however, the event itself is supported since Opera Android 20. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "safari": { - "version_added": "10.1", - "partial_implementation": true, - "notes": [ - "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", - "Before Safari 10.1, this event handler attribute was not supported; however, the event itself was supported since Safari 7. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - ] - }, - "safari_ios": { - "version_added": "10.3", - "partial_implementation": true, - "notes": [ - "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", - "Before Safari iOS 10.3, this event handler attribute was not supported; however, the event itself was supported since Safari iOS 7. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - ] - }, - "samsunginternet_android": { - "version_added": "8.0", - "notes": "Before Samsung Internet 8.0, this event handler attribute is not supported; however, the event itself is supported since Samsung Internet 2.0. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - }, - "webview_android": { - "version_added": "62", - "notes": "Before WebView 62, this event handler attribute is not supported; however, the event itself is supported since WebView 4.4.3. The event can be listened to via document.addEventListener('visibilitychange', function() {});." - } - }, - "status": { - "experimental": false, - "standard_track": true, - "deprecated": false - } - } - }, "open": { "__compat": { "mdn_url": "https://developer.mozilla.org/docs/Web/API/Document/open", @@ -10680,29 +10613,47 @@ "description": "visibilitychange event", "support": { "chrome": [ + { + "version_added": "62" + }, { "version_added": "33", - "notes": "Before Chrome 62, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Chrome, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "13", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." } ], "chrome_android": [ + { + "version_added": "62" + }, { "version_added": "33", - "notes": "Before Chrome 62, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Chrome, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "18", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." + } + ], + "edge": [ + { + "version_added": "18" + }, + { + "version_added": "12", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." } ], - "edge": { - "version_added": "12", - "notes": "Before Edge 18, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Edge, use document.addEventListener('visibilitychange', function() {});." - }, "firefox": { "version_added": "56" }, @@ -10711,72 +10662,131 @@ }, "ie": { "version_added": "10", - "notes": "The onvisibilitychange attribute is not supported in IE. To listen to this event, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, "opera": [ + { + "version_added": "49" + }, { "version_added": "20", - "notes": "Before Opera 49, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Opera, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "15", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "12.1", - "version_removed": "15" + "version_removed": "15", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." } ], "opera_android": [ + { + "version_added": "46" + }, { "version_added": "20", - "notes": "Before Opera Android 46, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Opera Android, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "14", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "12.1", - "version_removed": "14" + "version_removed": "14", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." + } + ], + "safari": [ + { + "version_added": "14", + "partial_implementation": true, + "notes": "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897." + }, + { + "version_added": "10.1", + "partial_implementation": true, + "notes": [ + "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", + "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not." + ] + }, + { + "version_added": "7", + "partial_implementation": true, + "notes": [ + "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", + "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", + "The onvisibilitychange event handler property is not supported." + ] + } + ], + "safari_ios": [ + { + "version_added": "14", + "partial_implementation": true, + "notes": "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897." + }, + { + "version_added": "10.3", + "partial_implementation": true, + "notes": [ + "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", + "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not." + ] + }, + { + "version_added": "7", + "partial_implementation": true, + "notes": [ + "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", + "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", + "The onvisibilitychange event handler property is not supported." + ] } ], - "safari": { - "version_added": "7", - "partial_implementation": true, - "notes": [ - "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", - "Before Safari 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", - "Before Safari 10.1, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Safari, use document.addEventListener('visibilitychange', function() {});." - ] - }, - "safari_ios": { - "version_added": "7", - "partial_implementation": true, - "notes": [ - "Doesn't fire the visibilitychange event when navigating away from a document, so also include code to check for the pagehide event (which does fire for that case in all current browsers). See WebKit bugs 116769, 151234, 151610, and 194897.", - "Before Safari iOS 14, the event does not bubble, so document.addEventListener('visibilitychange', ...) works, but window.addEventListener('visibilitychange', ...) does not.", - "Before Safari iOS 10.3, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Safari iOS, use document.addEventListener('visibilitychange', function() {});." - ] - }, "samsunginternet_android": [ + { + "version_added": "8.0" + }, { "version_added": "2.0", - "notes": "Before Samsung Internet 8.0, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of Samsung Internet, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "1.0", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." } ], "webview_android": [ + { + "version_added": "62" + }, { "version_added": "4.4.3", - "notes": "Before WebView 62, the onvisibilitychange attribute is not supported. To listen to this event in earlier versions of WebView, use document.addEventListener('visibilitychange', function() {});." + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." }, { "version_added": "≤37", - "prefix": "webkit" + "prefix": "webkit", + "partial_implementation": true, + "notes": "The onvisibilitychange event handler property is not supported." } ] },