Skip to content

Commit

Permalink
Delete all deprecated members
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Feb 25, 2025
1 parent b90b63d commit 460022f
Show file tree
Hide file tree
Showing 7 changed files with 3 additions and 423 deletions.
1 change: 1 addition & 0 deletions web/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
- Removed renames `UnderlyingSource` and `UnderlyingSourceBase` where the types
don't exist.
- Fixed generation of variadic arguments to generate 4 optional parameters.
- Removed all `@Deprecated` members.

## 1.1.0

Expand Down
8 changes: 0 additions & 8 deletions web/lib/helpers.dart

This file was deleted.

73 changes: 0 additions & 73 deletions web/lib/src/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,83 +21,10 @@
/// whether to consume some of the APIs provided here.
library;

import 'dart:js_interop';
import 'dart:js_interop_unsafe';

import 'dom.dart';
import 'helpers/lists.dart';

export 'helpers/cross_origin.dart' show CrossOriginLocation, CrossOriginWindow;
export 'helpers/enums.dart';
export 'helpers/events/events.dart';
export 'helpers/events/providers.dart';
export 'helpers/events/streams.dart' show ElementStream, EventStreamProvider;
export 'helpers/extensions.dart';
export 'helpers/http.dart';
export 'helpers/lists.dart';
export 'helpers/renames.dart';

/// Create an [HTMLElement] with the specified [tagName].
/// If no element with [tagName] exists, returns an [HTMLUnknownElement].
///
/// Deprecated in favor of creating the element like other HTML elements:
///
/// ```dart
/// final anchor = document.createElement('a') as HTMLElement;
/// ```
@Deprecated('Use the specific HTMLElement constructor instead.')
HTMLElement createElementTag(String tagName) =>
document.createElement(tagName) as HTMLElement;

/// Create an [HTMLCanvasElement] in the current [document].
///
/// Deprecated in favor of creating the element like other HTML elements:
///
/// ```dart
/// final canvas = document.createElement('canvas') as HTMLCanvasElement
/// ..width = 256
/// ..height = 256;
/// ```
@Deprecated('Use the HTMLCanvasElement constructor instead.')
HTMLCanvasElement createCanvasElement({int? width, int? height}) {
final result = document.createElement('canvas') as HTMLCanvasElement;
if (width != null) result.width = width;
if (height != null) result.height = height;
return result;
}

/// Create an [HTMLIFrameElement] in the current [document].
///
/// Deprecated in favor of creating the element like other HTML elements:
///
/// ```dart
/// final embed = document.createElement('iframe') as HTMLIFrameElement;
/// ```
@Deprecated('Use the HTMLIFrameElement constructor instead.')
HTMLIFrameElement createIFrameElement() =>
document.createElement('iframe') as HTMLIFrameElement;

@JS('Audio')
external JSFunction get _audioConstructor;
// While `new Audio()` is a different syntax from
// `document.createElement('audio')`, it looks like they're the same:
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLAudioElement/Audio#usage_notes
@Deprecated('Use the HTMLAudioElement constructor instead.')
HTMLAudioElement createAudioElement() => _audioConstructor.callAsConstructor();

/// Finds and returns the first element within the [document]
/// that matches the specified CSS [selector] string.
/// If no match is found, `null` is returned.
///
/// Deprecated in favor of querying directly on the [document]:
///
/// ```dart
/// final dartDiv = document.querySelector('div.dart');
/// ```
@Deprecated('Directly use document.querySelector instead.')
Element? querySelector(String selector) => document.querySelector(selector);

@Deprecated('Use JSImmutableListWrapper<TouchList, Touch> instead.')
class TouchListWrapper extends JSImmutableListWrapper<TouchList, Touch> {
TouchListWrapper(super._original);
}
4 changes: 2 additions & 2 deletions web/lib/src/helpers/events/streams.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,9 @@ class _EventStreamSubscription<T extends html.Event>
// `dart:html` it would have printed 1, 2, 4, 3
//
// ```dart
// import 'package:web/helpers.dart';
// import 'package:web/web.dart';
//
// main() {
// void main() {
// print('1');
// final body = document.body!;
// body.onTouchStart.first.whenComplete(() {
Expand Down
32 changes: 0 additions & 32 deletions web/lib/src/helpers/extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@ library;

import 'dart:convert';
import 'dart:js_interop';
import 'dart:math' show Point;

import '../dom.dart';
import 'lists.dart';

export 'cross_origin.dart'
show CrossOriginContentWindowExtension, CrossOriginWindowExtension;
Expand Down Expand Up @@ -71,43 +69,13 @@ extension CanvasRenderingContext2DGlue on CanvasRenderingContext2D {

extension NodeGlue on Node {
set text(String s) => textContent = s;
@Deprecated('See Node.appendChild()')
Node append(Node other) => appendChild(other);
@Deprecated('See Node.cloneNode()')
Node clone(bool? deep) => cloneNode(deep ?? false);
}

extension EventGlue on MouseEvent {
/// A [Point] representation of the [clientX] and [clientY] properties
/// of this [MouseEvent].
///
/// **Deprecated:** Prefer directly accessing
/// the [clientX] and [clientY] properties on [MouseEvent].
@Deprecated('Instead directly access the clientX and clientY properties.')
Point get client => Point(clientX, clientY);
}

extension TouchGlue on Touch {
/// A [Point] representation of the [clientX] and [clientY] properties
/// of this [Touch] event.
///
/// **Deprecated:** Prefer directly accessing
/// the [clientX] and [clientY] properties on [Touch].
@Deprecated('Instead directly access the clientX and clientY properties.')
Point get client => Point(clientX, clientY);
}

extension StorageGlue on Storage {
String? operator [](String key) => getItem(key);
void operator []=(String key, String value) => setItem(key, value);
}

@Deprecated('Use JSImmutableListWrapper<TouchList, Touch> instead.')
extension TouchListConvert on TouchList {
@Deprecated('Use JSImmutableListWrapper<TouchList, Touch> directly instead.')
List<Touch> toList() => JSImmutableListWrapper<TouchList, Touch>(this);
}

extension XMLHttpRequestGlue on XMLHttpRequest {
/// Returns all response headers as a key-value map.
///
Expand Down
Loading

0 comments on commit 460022f

Please sign in to comment.