fixes to the return types of several Node helper extension methods (#121)
* fixes to the return types of several Node helper extension methods
* update changelog
* Update lib/src/helpers/extensions.dart
* deprecated two helper extension methods
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71f5ee7..e809f5e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -3,9 +3,12 @@
- Exported the helper libraries from `web.dart`.
- Deprecated the `helpers.dart` library in favor of `web.dart`.
- Updated the readme to include usage info and package status.
-- Add an example.
-- `src/helpers.dart`:
- - Added event extensions for `WebSocket`
+- Added an example.
+- Added event extensions for `WebSocket`
+- Fixes to the return types of the `append()` and `clone()` extension methods on
+ `Node`.
+- Deprecated `NodeGlue.append` in favor of `Node.appendChild`.
+- Deprecated `NodeGlue.clone` in favor of `Node.cloneNode`.
## 0.4.0
diff --git a/lib/src/helpers.dart b/lib/src/helpers.dart
index d3d6b97..2771bf5 100644
--- a/lib/src/helpers.dart
+++ b/lib/src/helpers.dart
@@ -9,6 +9,7 @@
/// to have from `dart:html`.
///
/// This helper layer serves two purposes:
+///
/// * provide useful functionality in environments where `dart:html` is not
/// available (like on Wasm).
/// * help bridge the gap in functionality from the past, which may reduce
diff --git a/lib/src/helpers/extensions.dart b/lib/src/helpers/extensions.dart
index 54513b7..0135644 100644
--- a/lib/src/helpers/extensions.dart
+++ b/lib/src/helpers/extensions.dart
@@ -7,6 +7,7 @@
///
/// The extensions here are added by hand over time, depending on needs and use
/// cases. They currently consist of:
+///
/// * renames: methods that provide the same functionality, but use a more
/// idiomatic Dart name. Typically these renames match the names used in
/// `dart:html` in the past.
@@ -66,8 +67,10 @@
extension NodeGlue on Node {
set text(String s) => textContent = s;
- void append(Node other) => appendChild(other);
- void clone(bool deep) => cloneNode(deep);
+ @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 {