Skip to content

Delete all deprecated members #347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.1

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);
}
56 changes: 0 additions & 56 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 @@ -58,60 +56,6 @@ extension HTMLCanvasElementGlue on HTMLCanvasElement {
}
}

extension CanvasRenderingContext2DGlue on CanvasRenderingContext2D {
@Deprecated('See CanvasRenderingContext2D.drawImage')
void drawImageScaled(
CanvasImageSource image,
double dx,
double dy,
double dw,
double dh,
) =>
drawImage(image, dx, dy, dw, dh);
}

extension NodeGlue on Node {
@Deprecated('See Node.textContent')
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 {
@Deprecated('Use Storage.getItem instead')
String? operator [](String key) => getItem(key);
@Deprecated('Use Storage.setItem instead')
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