Deprecate a few more things before we launch v2 (#348)
diff --git a/web/CHANGELOG.md b/web/CHANGELOG.md index f49316b..927e374 100644 --- a/web/CHANGELOG.md +++ b/web/CHANGELOG.md
@@ -1,3 +1,8 @@ +## 1.1.1 + +- Deprecated `Node.text` extension. Use `Node.textContent` instead. +- Deprecated `[]` extensions on `Storage`. + ## 1.1.0 - Added `HttpStatus` class that declares http status codes. This is a copy of
diff --git a/web/analysis_options.yaml b/web/analysis_options.yaml index c7a2284..ac4fc0d 100644 --- a/web/analysis_options.yaml +++ b/web/analysis_options.yaml
@@ -33,7 +33,6 @@ - literal_only_boolean_expressions - no_adjacent_strings_in_list - no_runtimeType_toString - - package_api_docs - prefer_const_declarations - prefer_final_locals - unnecessary_await_in_return
diff --git a/web/example/example.dart b/web/example/example.dart index 6e38e5c..11f2622 100644 --- a/web/example/example.dart +++ b/web/example/example.dart
@@ -6,5 +6,5 @@ void main() { final div = document.querySelector('div')!; - div.text = 'Text set at ${DateTime.now()}'; + div.textContent = 'Text set at ${DateTime.now()}'; }
diff --git a/web/lib/src/helpers/events/streams.dart b/web/lib/src/helpers/events/streams.dart index 266a49d..060ea48 100644 --- a/web/lib/src/helpers/events/streams.dart +++ b/web/lib/src/helpers/events/streams.dart
@@ -176,9 +176,9 @@ // `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(() {
diff --git a/web/lib/src/helpers/extensions.dart b/web/lib/src/helpers/extensions.dart index bdcfc20..45df488 100644 --- a/web/lib/src/helpers/extensions.dart +++ b/web/lib/src/helpers/extensions.dart
@@ -59,6 +59,7 @@ } extension CanvasRenderingContext2DGlue on CanvasRenderingContext2D { + @Deprecated('See CanvasRenderingContext2D.drawImage') void drawImageScaled( CanvasImageSource image, double dx, @@ -70,6 +71,7 @@ } extension NodeGlue on Node { + @Deprecated('See Node.textContent') set text(String s) => textContent = s; @Deprecated('See Node.appendChild()') Node append(Node other) => appendChild(other); @@ -98,7 +100,9 @@ } 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); } @@ -119,9 +123,8 @@ // from Closure's goog.net.Xhrio.getResponseHeaders. final headers = <String, String>{}; final headersString = getAllResponseHeaders(); - final headersList = - LineSplitter.split(headersString).where((header) => header.isNotEmpty); - for (final header in headersList) { + for (final header in LineSplitter.split(headersString) + .where((header) => header.isNotEmpty)) { final split = header.split(': '); if (split.length <= 1) { continue;
diff --git a/web/pubspec.yaml b/web/pubspec.yaml index ab95146..62aaacc 100644 --- a/web/pubspec.yaml +++ b/web/pubspec.yaml
@@ -1,5 +1,5 @@ name: web -version: 1.1.0 +version: 1.1.1 description: Lightweight browser API bindings built around JS interop. repository: https://github.com/dart-lang/web
diff --git a/web/test/helpers_test.dart b/web/test/helpers_test.dart index fb1f82f..4ffa81a 100644 --- a/web/test/helpers_test.dart +++ b/web/test/helpers_test.dart
@@ -23,9 +23,9 @@ test('Converts a JS list to a dart list using JSImmutableListWrapper', () { final div = (document.createElement('div')) - ..append(document.createElement('div')..text = '1') - ..append(document.createElement('div')..text = '2') - ..append(document.createElement('div')..text = '3'); + ..append(document.createElement('div')..textContent = '1') + ..append(document.createElement('div')..textContent = '2') + ..append(document.createElement('div')..textContent = '3'); final List<Node> dartList = JSImmutableListWrapper<NodeList, Node>(div.querySelectorAll('div'));
diff --git a/web_generator/analysis_options.yaml b/web_generator/analysis_options.yaml index c4ebe40..0242634 100644 --- a/web_generator/analysis_options.yaml +++ b/web_generator/analysis_options.yaml
@@ -19,7 +19,6 @@ - literal_only_boolean_expressions - no_adjacent_strings_in_list - no_runtimeType_toString - - package_api_docs - prefer_const_declarations - prefer_final_locals - unnecessary_await_in_return
diff --git a/web_generator/lib/src/translator.dart b/web_generator/lib/src/translator.dart index 95e4fbf..ef58c04 100644 --- a/web_generator/lib/src/translator.dart +++ b/web_generator/lib/src/translator.dart
@@ -524,7 +524,9 @@ } final isStatic = operation.special == 'static'; if (shouldQueryMDN && - !_shouldGenerateMember(operationName, isStatic: isStatic)) break; + !_shouldGenerateMember(operationName, isStatic: isStatic)) { + break; + } final docs = shouldQueryMDN ? mdnInterface?.propertyFor(operationName, isStatic: isStatic) : null;