Skip to content

Commit 9b3d96a

Browse files
Remove dart:html page (#6345)
Fixes #6314 --------- Co-authored-by: Parker Lougheed <parlough@gmail.com>
1 parent d9d877a commit 9b3d96a

File tree

14 files changed

+55
-22
lines changed

14 files changed

+55
-22
lines changed

examples/misc/test/language_tour/browser_test.dart

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1+
// ignore_for_file: unused_import
2+
13
@Tags(['browser'])
24
@TestOn('browser')
35
library;
46

5-
// #docregion dart-html-import
7+
// #docregion dart-js-interop-import
8+
import 'dart:js_interop';
9+
// #enddocregion dart-js-interop-import
610
import 'dart:html';
7-
// #enddocregion dart-html-import
811
// #docregion package-import
912
import 'package:test/test.dart';
1013
// #enddocregion package-import

firebase.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,14 +140,14 @@
140140
{ "source": "/docs/spec/deferred-loading", "destination": "/language/libraries#lazily-loading-a-library", "type": 301 },
141141
{ "source": "/docs/spec{,/**}", "destination": "/resources/language/spec", "type": 301 },
142142
{ "source": "/docs/technical-overview{,/**}", "destination": "/overview", "type": 301 },
143-
{ "source": "/docs/tutorials/add-elements", "destination": "/library/dart-html", "type": 301 },
143+
{ "source": "/docs/tutorials/add-elements", "destination": "/interop/js-interop/package-web", "type": 301 },
144144
{ "source": "/docs/tutorials/cmdline", "destination": "/tutorials/server/cmdline", "type": 301 },
145-
{ "source": "/docs/tutorials/connect-dart-html", "destination": "/library/dart-html", "type": 301 },
145+
{ "source": "/docs/tutorials/connect-dart-html", "destination": "/interop/js-interop/package-web", "type": 301 },
146146
{ "source": "/docs/tutorials/fetchdata", "destination": "/tutorials/server/fetch-data", "type": 301 },
147147
{ "source": "/docs/tutorials/futures", "destination": "/libraries/async/async-await", "type": 301 },
148148
{ "source": "/docs/tutorials/get-started", "destination": "/tutorials/server/get-started", "type": 301 },
149149
{ "source": "/docs/tutorials/httpserver", "destination": "/tutorials/server/httpserver", "type": 301 },
150-
{ "source": "/docs/tutorials/remove-elements", "destination": "/library/dart-html", "type": 301 },
150+
{ "source": "/docs/tutorials/remove-elements", "destination": "/interop/js-interop/package-web", "type": 301 },
151151
{ "source": "/docs/tutorials/shared-pkgs", "destination": "/tools/pub/packages", "type": 301 },
152152
{ "source": "/docs/tutorials/streams", "destination": "/libraries/async/using-streams", "type": 301 },
153153
{ "source": "/docs/tutorials{,/**}", "destination": "/tutorials", "type": 301 },
@@ -436,7 +436,7 @@
436436
{ "source": "/tutorials/web/fetch-data", "destination": "/tutorials/server/fetch-data", "type": 301 },
437437
{ "source": "/tutorials/web/get-started", "destination": "/web/get-started", "type": 301 },
438438
{ "source": "/tutorials/web/low-level-html", "destination": "/web/get-started", "type": 301 },
439-
{ "source": "/tutorials/web/low-level-html/:rest*", "destination": "/libraries/dart-html", "type": 301 },
439+
{ "source": "/tutorials/web/low-level-html/:rest*", "destination": "/interop/js-interop/package-web", "type": 301 },
440440
{ "source": "/web/dart-2", "destination": "/tools/webdev", "type": 301 },
441441
{ "source": "/web/js-interop", "destination": "/interop/js-interop", "type": 301 },
442442
{ "source": "/{docs,tools}/{pub-package-manager,pub/cmd,pub/tools/pub}/glossary", "destination": "/tools/pub/glossary", "type": 301 }

src/_data/sidenav.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,9 @@
114114
permalink: /libraries/dart-convert
115115
- title: dart:io
116116
permalink: /libraries/dart-io
117-
- title: dart:html
118-
permalink: /libraries/dart-html
117+
- title: dart:js_interop
118+
permalink: /interop/js-interop
119+
match-page-url-exactly: true
119120
- divider
120121
- title: Iterable collections
121122
permalink: /libraries/collections/iterables

src/content/interop/js-interop/index.md

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
title: JavaScript interoperability
33
short-title: JS interop
44
description: Integrate JavaScript code into your Dart web app.
5+
nextpage:
6+
url: /interop/js-interop/usage
7+
title: Usage
58
---
69

710
The [Dart web platform](/overview#web-platform) supports communication with

src/content/interop/js-interop/js-types.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
title: JS types
33
description: Usage information about the core types in JS interop.
4+
prevpage:
5+
url: /interop/js-interop/usage
6+
title: Usage
7+
nextpage:
8+
url: /interop/js-interop/tutorials
9+
title: JS interop tutorials
410
---
511

612
Dart values and JS values belong to separate language domains. When compiling to

src/content/interop/js-interop/package-web.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
---
22
title: Migrate to package:web
33
description: How to migrate web interop code from dart:html to package:web.
4+
prevpage:
5+
url: /interop/js-interop/past-js-interop
6+
title: Past JS interop
47
---
58

69
Dart's [`package:web`][] exposes access to browser APIs,

src/content/interop/js-interop/past-js-interop.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
title: Past JS interop
33
description: Archive of Dart's previous JS interop support.
4+
prevpage:
5+
url: /interop/js-interop/tutorials
6+
title: JS interop tutorials
7+
nextpage:
8+
url: /interop/js-interop/package-web/
9+
title: Migrate to package:web
410
---
511

612
:::warning

src/content/interop/js-interop/tutorials.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
title: JS interop tutorials
33
description: Tutorials for common JavaScript interop use cases in Dart.
4+
prevpage:
5+
url: /interop/js-interop/js-types
6+
title: JS types
7+
nextpage:
8+
url: /interop/js-interop/past-js-interop
9+
title: Past JS interop
410
---
511

612
## Tutorials

src/content/interop/js-interop/usage.md

+6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
22
title: Usage
33
description: How to declare and use JS interop members.
4+
prevpage:
5+
url: /interop/js-interop/
6+
title: JS interop
7+
nextpage:
8+
url: /interop/js-interop/js-types
9+
title: JS types
410
---
511

612
JS interop provides the mechanisms to interact with JavaScript APIs from Dart.

src/content/language/libraries.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ like `public` or `private`, consult
3131
Use `import` to specify how a namespace from one library is used in the
3232
scope of another library.
3333

34-
For example, Dart web apps generally use the [dart:html][]
34+
For example, Dart web apps generally use the [`dart:js_interop`][]
3535
library, which they can import like this:
3636

37-
<?code-excerpt "misc/test/language_tour/browser_test.dart (dart-html-import)"?>
37+
<?code-excerpt "misc/test/language_tour/browser_test.dart (dart-js-interop-import)"?>
3838
```dart
39-
import 'dart:html';
39+
import 'dart:js_interop';
4040
```
4141

4242
The only required argument to `import` is a URI specifying the
@@ -178,6 +178,6 @@ for advice on how to implement a package, including:
178178
* How to use conditional imports and exports to implement
179179
a library that supports multiple platforms.
180180

181-
[dart:html]: {{site.dart-api}}/dart-html
181+
[`dart:js_interop`]: {{site.dart-api}}/dart-js_interop/dart-js_interop-library.html
182182
[doc comments]: /effective-dart/documentation#consider-writing-a-library-level-doc-comment
183183
[metadata annotations]: /language/metadata

src/content/libraries/dart-html.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@ prevpage:
77
---
88

99
:::warning
10-
`dart:html` is being replaced with [`package:web`][].
11-
Package maintainers should migrate to `package:web` as
12-
soon as possible to be compatible with Wasm.
13-
Read the [Migrate to package:web][] page for guidance.
10+
The `dart:html` library is deprecated.
11+
Instead, use [`dart:js_interop`][] and [`package:web`][].
1412
:::
1513

1614
Use the [dart:html][] library to program the browser, manipulate objects and
@@ -36,6 +34,7 @@ To use the HTML library in your web app, import dart:html:
3634
import 'dart:html';
3735
```
3836

37+
[`dart:js_interop`]: /interop/js-interop
3938
[`package:web`]: {{site.pub-pkg}}/web
4039
[Migrate to package:web]: /interop/js-interop/package-web
4140

src/content/libraries/dart-io.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ prevpage:
55
url: /libraries/dart-convert
66
title: dart:convert
77
nextpage:
8-
url: /libraries/dart-html
9-
title: dart:html
8+
url: /interop/js-interop/
9+
title: dart:js_interop
1010
---
1111

1212
<?code-excerpt plaster="none"?>

src/content/libraries/index.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ consult the [Dart API reference.][Dart API]
4646
: I/O for programs that can use the Dart VM,
4747
including Flutter apps, servers, and command-line scripts.
4848

49-
[dart:html](/libraries/dart-html)
50-
: DOM and other APIs for browser-based apps.
51-
We now recommend using `package:web` over `dart:html`.
49+
[dart:js_interop](/interop/js-interop)
50+
: APIs for interop with the web platform.
51+
Along with `package:web`,`dart:js_interop` replaces `dart:html`.
5252

5353

5454
As mentioned, these pages are just an overview;

src/content/overview.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ providing essentials for many everyday programming tasks:
148148
(`dart:isolate`)
149149
* HTML elements and other resources for web-based applications that need to
150150
interact with the browser and the Document Object Model (DOM)
151-
(`dart:html`)
151+
(`dart:js_interop` and `package:web`)
152152

153153
Beyond the core libraries, many APIs are provided through
154154
a comprehensive set of packages.

0 commit comments

Comments
 (0)