silly
diff --git a/web/lib/src/dom/cssom.dart b/web/lib/src/dom/cssom.dart
index df9cdba..8e28008 100644
--- a/web/lib/src/dom/cssom.dart
+++ b/web/lib/src/dom/cssom.dart
@@ -201,6 +201,7 @@
/// stylesheet. You should avoid using this method, and should instead use the
/// more standard
/// [CSSStyleSheet.insertRule] method.
+ @deprecated
external int addRule([
String selector,
String style,
@@ -216,6 +217,7 @@
/// > This is a _legacy method_ which has been replaced by
/// > the standard method [CSSStyleSheet.deleteRule]. You
/// > should use that instead.
+ @deprecated
external void removeRule([int index]);
/// The read-only [CSSStyleSheet] property
diff --git a/web/lib/src/dom/cssom_view.dart b/web/lib/src/dom/cssom_view.dart
index 96a6383..2ed9850 100644
--- a/web/lib/src/dom/cssom_view.dart
+++ b/web/lib/src/dom/cssom_view.dart
@@ -73,6 +73,7 @@
/// so this method was provided as an alias of [EventTarget.addEventListener].
/// Use `addEventListener()` instead of `addListener()` if it is
/// available in the browsers you need to support.
+ @deprecated
external void addListener(EventListener? callback);
/// The **`removeListener()`** method of the
@@ -84,6 +85,7 @@
/// [EventTarget.removeEventListener].
/// Use `removeEventListener()` instead of `removeListener()` if it is
/// available in the browsers you need to support.
+ @deprecated
external void removeListener(EventListener? callback);
/// The **`media`** read-only property of the
diff --git a/web/lib/src/dom/dom.dart b/web/lib/src/dom/dom.dart
index d238736..84607b8 100644
--- a/web/lib/src/dom/dom.dart
+++ b/web/lib/src/dom/dom.dart
@@ -160,6 +160,7 @@
/// > The page on
/// > [Creating and triggering events](https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events)
/// > gives more information about the way to use these.
+ @deprecated
external void initEvent(
String type, [
bool bubbles,
@@ -367,6 +368,7 @@
/// > The page on
/// > [Creating and triggering events](https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events)
/// > gives more information about the way to use those.
+ @deprecated
external void initCustomEvent(
String type, [
bool bubbles,
@@ -1536,6 +1538,7 @@
/// of the type specified. The
/// returned object should be first initialized and can then be passed to
/// [EventTarget.dispatchEvent].
+ @deprecated
external Event createEvent(String interface);
/// The **`Document.createRange()`** method returns a new
@@ -1687,6 +1690,7 @@
/// > `document.write()` on a closed (loaded) document automatically calls
/// > `document.open()`,
/// > [which will clear the document](https://developer.mozilla.org/en-US/docs/Web/API/Document/open#notes).
+ @deprecated
external void write([
JSAny text1,
JSAny text2,
@@ -1746,18 +1750,24 @@
/// > `execCommand()` in response to these events. From Firefox 82, nested
/// > `execCommand()` calls will always fail, see
/// > [bug 1634262](https://bugzil.la/1634262).
+ @deprecated
external bool execCommand(
String commandId, [
bool showUI,
String value,
]);
+ @deprecated
external bool queryCommandIndeterm(String commandId);
+ @deprecated
external String queryCommandValue(String commandId);
/// The **`Document.clear()`** method does nothing, but doesn't raise any
/// error.
+ @deprecated
external void clear();
+ @deprecated
external void captureEvents();
+ @deprecated
external void releaseEvents();
/// The **`exitPictureInPicture()`** method of the [Document] interface
@@ -1940,6 +1950,7 @@
/// The **`createNSResolver()`** method of the [Document] interface used to
/// create a custom `XPathNSResolver` object. It now returns the input as-is
/// and is only kept for compatibility reasons.
+ @deprecated
external Node createNSResolver(Node nodeResolver);
/// The **`evaluate()`** method of the [Document] interface selects elements
@@ -2737,6 +2748,7 @@
/// The latest version of the spec settled to force this method to always
/// return
/// `true`, where the functionality was accurate and in use.
+ @deprecated
external bool hasFeature();
}
@@ -5362,6 +5374,7 @@
/// iterator's state to
/// `INVALID`. Once this method had been called, calls to other methods on
/// `NodeIterator` would raise the `INVALID_STATE_ERR` exception.
+ @deprecated
external void detach();
/// The **`NodeIterator.root`** read-only property represents the
@@ -5788,6 +5801,7 @@
/// The **`createNSResolver()`** method of the [XPathEvaluator] interface used
/// to create a custom `XPathNSResolver` object. It now returns the input
/// as-is and is only kept for compatibility reasons.
+ @deprecated
external Node createNSResolver(Node nodeResolver);
/// The `evaluate()` method of the [XPathEvaluator] interface
diff --git a/web/lib/src/dom/fileapi.dart b/web/lib/src/dom/fileapi.dart
index ca57268..1227a24 100644
--- a/web/lib/src/dom/fileapi.dart
+++ b/web/lib/src/dom/fileapi.dart
@@ -277,6 +277,7 @@
/// but
/// re-introduced for backward compatibility.
/// Using [FileReader.readAsArrayBuffer] is recommended.
+ @deprecated
external void readAsBinaryString(Blob blob);
/// The **`readAsText()`** method of the [FileReader] interface is used to
@@ -393,6 +394,7 @@
/// [only available](https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Functions_and_classes_available_to_workers)
/// in [workers](https://developer.mozilla.org/en-US/docs/Web/API/Worker) as
/// it enables synchronous I/O that could potentially block.
+ @deprecated
external String readAsBinaryString(Blob blob);
/// @AvailableInWorkers("worker_except_service")
diff --git a/web/lib/src/dom/geometry.dart b/web/lib/src/dom/geometry.dart
index 1102479..61942da 100644
--- a/web/lib/src/dom/geometry.dart
+++ b/web/lib/src/dom/geometry.dart
@@ -482,6 +482,7 @@
num originY,
num originZ,
]);
+ @deprecated
external DOMMatrix scaleNonUniform([
num scaleX,
num scaleY,
diff --git a/web/lib/src/dom/html.dart b/web/lib/src/dom/html.dart
index ea31960..5101315 100644
--- a/web/lib/src/dom/html.dart
+++ b/web/lib/src/dom/html.dart
@@ -12185,6 +12185,7 @@
/// > abusing this functionality.
/// > In Firefox, you can enable the old behavior with the
/// > `dom.disable_window_flip` preference.
+ @deprecated
external void blur();
/// The **`open()`** method of the
@@ -12359,9 +12360,11 @@
/// > [!NOTE]
/// > This is an method long removed from the specification. It is kept in
/// > browsers to prevent code breakage but does nothing.
+ @deprecated
external void captureEvents();
/// Releases the window from trapping events of a specific type.
+ @deprecated
external void releaseEvents();
/// The **`window.requestIdleCallback()`** method queues a function
@@ -14289,6 +14292,7 @@
/// Tainting was a security method used by JavaScript 1.2. It has long been
/// removed; this
/// method only stays for maintaining compatibility with very old scripts.
+ @deprecated
external bool taintEnabled();
/// The **[Navigator]** method **`registerProtocolHandler()`** lets websites
@@ -14326,6 +14330,7 @@
);
/// This method always returns false.
+ @deprecated
external bool javaEnabled();
/// The **`clipboard`** read-only property of the [Navigator] interface
@@ -14774,8 +14779,11 @@
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/PluginArray).
@deprecated
extension type PluginArray._(JSObject _) implements JSObject {
+ @deprecated
external void refresh();
+ @deprecated
external Plugin? item(int index);
+ @deprecated
external Plugin? namedItem(String name);
@deprecated
external int get length;
@@ -14799,7 +14807,9 @@
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/MimeTypeArray).
@deprecated
extension type MimeTypeArray._(JSObject _) implements JSObject {
+ @deprecated
external MimeType? item(int index);
+ @deprecated
external MimeType? namedItem(String name);
@deprecated
external int get length;
@@ -14817,7 +14827,9 @@
/// [MDN Web Docs](https://developer.mozilla.org/en-US/docs/Web/API/Plugin).
@deprecated
extension type Plugin._(JSObject _) implements JSObject {
+ @deprecated
external MimeType? item(int index);
+ @deprecated
external MimeType? namedItem(String name);
@deprecated
external String get name;
@@ -14938,6 +14950,7 @@
MessageEventInit eventInitDict,
]);
+ @deprecated
external void initMessageEvent(
String type, [
bool bubbles,
@@ -16301,6 +16314,7 @@
/// The **`StorageEvent.initStorageEvent()`** method is used to initialize the
/// value of a [StorageEvent].
+ @deprecated
external void initStorageEvent(
String type, [
bool bubbles,
@@ -16371,7 +16385,9 @@
/// Creates an [HTMLMarqueeElement] using the tag 'marquee'.
HTMLMarqueeElement() : _ = document.createElement('marquee');
+ @deprecated
external void start();
+ @deprecated
external void stop();
@deprecated
external String get behavior;
@@ -16671,6 +16687,8 @@
}
@deprecated
extension type External._(JSObject _) implements JSObject {
+ @deprecated
external void AddSearchProvider();
+ @deprecated
external void IsSearchProviderInstalled();
}
diff --git a/web/lib/src/dom/navigation_timing.dart b/web/lib/src/dom/navigation_timing.dart
index 03819f8..ec53290 100644
--- a/web/lib/src/dom/navigation_timing.dart
+++ b/web/lib/src/dom/navigation_timing.dart
@@ -190,6 +190,7 @@
///
/// The legacy **`toJSON()`** method of the [PerformanceTiming] interface is a
/// ; it returns a JSON representation of the [PerformanceTiming] object.
+ @deprecated
external JSObject toJSON();
/// > [!WARNING]
@@ -613,6 +614,7 @@
///
/// The **`toJSON()`** method of the [PerformanceNavigation] interface is a ;
/// it returns a JSON representation of the [PerformanceNavigation] object.
+ @deprecated
external JSObject toJSON();
/// The legacy
diff --git a/web/lib/src/dom/permissions.dart b/web/lib/src/dom/permissions.dart
index ed96734..76e344c 100644
--- a/web/lib/src/dom/permissions.dart
+++ b/web/lib/src/dom/permissions.dart
@@ -64,6 +64,7 @@
/// it's unlikely to reach the standards track.
/// For more context, see the [original discussion to remove
/// `permissions.revoke()`](https://github.com/w3c/permissions/issues/46).
+ @deprecated
external JSPromise<PermissionStatus> revoke(JSObject permissionDesc);
}
diff --git a/web/lib/src/dom/svg.dart b/web/lib/src/dom/svg.dart
index b05e5b9..2ae745c 100644
--- a/web/lib/src/dom/svg.dart
+++ b/web/lib/src/dom/svg.dart
@@ -1353,9 +1353,13 @@
/// the document tree) for an [Element] whose `id` property matches the
/// specified string.
external Element getElementById(String elementId);
+ @deprecated
external int suspendRedraw(int maxWaitMilliseconds);
+ @deprecated
external void unsuspendRedraw(int suspendHandleID);
+ @deprecated
external void unsuspendRedrawAll();
+ @deprecated
external void forceRedraw();
/// The `pauseAnimations()` method of the [SVGSVGElement] interface suspends
@@ -2561,6 +2565,7 @@
///
/// If no character is found at the specified position, `-1` is returned.
external int getCharNumAtPosition([DOMPointInit point]);
+ @deprecated
external void selectSubString(
int charnum,
int nchars,
diff --git a/web/lib/src/dom/uievents.dart b/web/lib/src/dom/uievents.dart
index 2e5cb0b..45eda30 100644
--- a/web/lib/src/dom/uievents.dart
+++ b/web/lib/src/dom/uievents.dart
@@ -57,6 +57,7 @@
/// > page on
/// > [Creating and triggering events](https://developer.mozilla.org/en-US/docs/Web/Events/Creating_and_triggering_events)
/// > gives more information about the way to use these.
+ @deprecated
external void initUIEvent(
String typeArg, [
bool bubblesArg,
@@ -231,6 +232,7 @@
/// [Document.createEvent] method.
/// This method must be called to set the event
/// before it is dispatched, using [EventTarget.dispatchEvent].
+ @deprecated
external void initMouseEvent(
String typeArg, [
bool bubblesArg,
@@ -911,6 +913,7 @@
/// implementing this method as experimental broke existing web apps (see
/// [Firefox bug 999645](https://bugzil.la/999645)).
/// Web applications should use constructor instead of this if it's available.
+ @deprecated
external void initKeyboardEvent(
String typeArg, [
bool bubblesArg,
@@ -1213,6 +1216,7 @@
/// > [!NOTE]
/// > The correct way of creating a [CompositionEvent] is to use
/// > the constructor [CompositionEvent.CompositionEvent].
+ @deprecated
external void initCompositionEvent(
String typeArg, [
bool bubblesArg,
@@ -1266,6 +1270,7 @@
/// > [!NOTE]
/// > In general, you won't create these events yourself; they are created by
/// > the browser.
+ @deprecated
external void initTextEvent(
String type, [
bool bubbles,
diff --git a/web/lib/src/dom/webaudio.dart b/web/lib/src/dom/webaudio.dart
index 97fb07a..cc9c3ab 100644
--- a/web/lib/src/dom/webaudio.dart
+++ b/web/lib/src/dom/webaudio.dart
@@ -265,6 +265,7 @@
/// > This feature was replaced by
/// > [AudioWorklets](https://developer.mozilla.org/en-US/docs/Web/API/AudioWorklet)
/// > and the [AudioWorkletNode] interface.
+ @deprecated
external ScriptProcessorNode createScriptProcessor([
int bufferSize,
int numberOfInputChannels,
@@ -1425,6 +1426,7 @@
/// > As this method is deprecated, use the three [AudioListener.positionX],
/// > [AudioListener.positionY], and [AudioListener.positionZ] properties
/// > instead.
+ @deprecated
external void setPosition(
num x,
num y,
@@ -1446,6 +1448,7 @@
///
/// The two vectors must be separated by an angle of 90° — in linear analysis
/// terms, they must be perpendicular to each other.
+ @deprecated
external void setOrientation(
num x,
num y,
@@ -2816,6 +2819,7 @@
/// coordinate system.
///
/// The `setPosition()` method's default value of the position is `(0, 0, 0)`.
+ @deprecated
external void setPosition(
num x,
num y,
@@ -2843,6 +2847,7 @@
/// The three parameters `x`, `y` and `z` are unitless and describe a
/// direction vector in 3D space using the right-hand Cartesian coordinate
/// system. The default value of the direction vector is `(1, 0, 0)`.
+ @deprecated
external void setOrientation(
num x,
num y,
diff --git a/web/lib/src/helpers/events/providers.dart b/web/lib/src/helpers/events/providers.dart
index e769b51..bfa8f21 100644
--- a/web/lib/src/helpers/events/providers.dart
+++ b/web/lib/src/helpers/events/providers.dart
@@ -50,6 +50,8 @@
static const EventStreamProvider<Event> audioEndEvent =
EventStreamProvider<Event>('audioend');
+ // ignore: provide_deprecation_message
+ @deprecated
static const EventStreamProvider<AudioProcessingEvent> audioProcessEvent =
EventStreamProvider<AudioProcessingEvent>('audioprocess');
diff --git a/web_generator/lib/src/translator.dart b/web_generator/lib/src/translator.dart
index 06d0783..5f8e89d 100644
--- a/web_generator/lib/src/translator.dart
+++ b/web_generator/lib/src/translator.dart
@@ -356,8 +356,9 @@
abstract class _OverridableMember {
final List<_Parameter> parameters = [];
+ final bool deprecated;
- _OverridableMember(JSArray<idl.Argument> rawParameters) {
+ _OverridableMember(JSArray<idl.Argument> rawParameters, this.deprecated) {
for (var i = 0; i < rawParameters.length; i++) {
parameters.add(_Parameter(rawParameters[i]));
}
@@ -393,12 +394,17 @@
late final _MemberName name = _generateName();
_OverridableOperation._(this._name, this.special, this.returnType,
- this.mdnProperty, super.parameters);
+ this.mdnProperty, super.parameters, super.deprecated);
factory _OverridableOperation(idl.Operation operation, _MemberName memberName,
- MdnProperty? mdnProperty) =>
- _OverridableOperation._(memberName, operation.special,
- _getRawType(operation.idlType), mdnProperty, operation.arguments);
+ MdnProperty? mdnProperty, bool deprecated) =>
+ _OverridableOperation._(
+ memberName,
+ operation.special,
+ _getRawType(operation.idlType),
+ mdnProperty,
+ operation.arguments,
+ deprecated);
bool get isStatic => special == 'static';
@@ -435,8 +441,8 @@
}
class _OverridableConstructor extends _OverridableMember {
- _OverridableConstructor(idl.Constructor constructor)
- : super(constructor.arguments);
+ _OverridableConstructor(idl.Constructor constructor, bool deprecated)
+ : super(constructor.arguments, deprecated);
void update(idl.Constructor that) => _processParameters(that.arguments);
}
@@ -475,7 +481,7 @@
final idlConstructor = member as idl.Constructor;
if (_hasHTMLConstructorAttribute(idlConstructor)) break;
if (constructor == null) {
- constructor = _OverridableConstructor(idlConstructor);
+ constructor = _OverridableConstructor(idlConstructor, false);
} else {
constructor!.update(idlConstructor);
}
@@ -559,7 +565,10 @@
staticOperations[operationName]!.update(operation);
} else {
staticOperations[operationName] = _OverridableOperation(
- operation, _MemberName(operationName), docs);
+ operation,
+ _MemberName(operationName),
+ docs,
+ _memberIsDeprecated(operationName, isStatic: true));
if (operations.containsKey(operationName)) {
staticOperations[operationName]!.underscoreName();
}
@@ -570,7 +579,10 @@
} else {
staticOperations[operationName]?.underscoreName();
operations[operationName] = _OverridableOperation(
- operation, _MemberName(operationName), docs);
+ operation,
+ _MemberName(operationName),
+ docs,
+ _memberIsDeprecated(operationName));
}
}
break;
@@ -967,7 +979,7 @@
T _overridableMember<T>(
_OverridableMember member,
T Function(List<code.Parameter> requiredParameters,
- List<code.Parameter> optionalParameters)
+ List<code.Parameter> optionalParameters, bool deprecated)
generator) {
final requiredParameters = <code.Parameter>[];
final optionalParameters = <code.Parameter>[];
@@ -990,20 +1002,24 @@
}
}
}
- return generator(requiredParameters, optionalParameters);
+ return generator(requiredParameters, optionalParameters, member.deprecated);
}
code.Constructor _constructor(_OverridableConstructor constructor) =>
_overridableMember<code.Constructor>(
constructor,
- (requiredParameters, optionalParameters) => code.Constructor((b) => b
- ..external = true
- // TODO(srujzs): Should we generate generative or factory
- // constructors? With `@staticInterop`, factories were needed, but
- // extension types have no such limitation.
- ..factory = true
- ..requiredParameters.addAll(requiredParameters)
- ..optionalParameters.addAll(optionalParameters)));
+ (requiredParameters, optionalParameters, deprecated) =>
+ code.Constructor((b) => b
+ ..annotations.addAll([
+ if (deprecated) code.refer('deprecated').expression,
+ ])
+ ..external = true
+ // TODO(srujzs): Should we generate generative or factory
+ // constructors? With `@staticInterop`, factories were needed,
+ // but extension types have no such limitation.
+ ..factory = true
+ ..requiredParameters.addAll(requiredParameters)
+ ..optionalParameters.addAll(optionalParameters)));
// TODO(srujzs): We don't need constructors for many dictionaries as they're
// only ever returned from APIs instead of passed to them. However,
@@ -1076,15 +1092,19 @@
: _typeReference(operation.returnType, returnType: true);
return _overridableMember<code.Method>(
operation,
- (requiredParameters, optionalParameters) => code.Method((b) => b
- ..annotations.addAll(_jsOverride(memberName.jsOverride))
- ..external = true
- ..static = operation.isStatic
- ..returns = returnType
- ..name = memberName.name
- ..docs.addAll(operation.mdnProperty?.formattedDocs ?? [])
- ..requiredParameters.addAll(requiredParameters)
- ..optionalParameters.addAll(optionalParameters)),
+ (requiredParameters, optionalParameters, deprecated) =>
+ code.Method((b) => b
+ ..annotations.addAll([
+ ..._jsOverride(memberName.jsOverride),
+ if (deprecated) code.refer('deprecated').expression,
+ ])
+ ..external = true
+ ..static = operation.isStatic
+ ..returns = returnType
+ ..name = memberName.name
+ ..docs.addAll(operation.mdnProperty?.formattedDocs ?? [])
+ ..requiredParameters.addAll(requiredParameters)
+ ..optionalParameters.addAll(optionalParameters)),
);
}