Skip to content

Commit bb293ef

Browse files
srawlinscommit-bot@chromium.org
authored andcommitted
Fix docs for Window.close() and Window.location=
* `closed` is not a method. * `location` is not a method. * `location=` does _not_ take a String; only a Location object. Fixes #16893 Change-Id: Ia5389ae80c39c5c7d9eebdd0cd04cb994a27fd7d Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111965 Reviewed-by: Terry Lucas <terry@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
1 parent df41391 commit bb293ef

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

sdk/lib/html/dart2js/html_dart2js.dart

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30564,7 +30564,7 @@ class Window extends EventTarget
3056430564
// TODO: consider forcing users to do: window.location.assign('string').
3056530565
/**
3056630566
* Sets the window's location, which causes the browser to navigate to the new
30567-
* location. [value] may be a Location object or a String.
30567+
* location.
3056830568
*/
3056930569
set location(value) {
3057030570
_location = value;
@@ -34587,12 +34587,14 @@ abstract class WindowBase implements EventTarget {
3458734587
* var other = window.open('http://www.example.com', 'foo');
3458834588
* // Closes other window, as it is script-closeable.
3458934589
* other.close();
34590-
* print(other.closed()); // 'true'
34590+
* print(other.closed); // 'true'
3459134591
*
34592-
* window.location('http://www.mysite.com', 'foo');
34592+
* var newLocation = window.location
34593+
* ..href = 'http://www.mysite.com';
34594+
* window.location = newLocation;
3459334595
* // Does not close this window, as the history has changed.
3459434596
* window.close();
34595-
* print(window.closed()); // 'false'
34597+
* print(window.closed); // 'false'
3459634598
*
3459734599
* See also:
3459834600
*

tools/dom/src/CrossFrameTypes.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,14 @@ abstract class WindowBase implements EventTarget {
116116
* var other = window.open('http://www.example.com', 'foo');
117117
* // Closes other window, as it is script-closeable.
118118
* other.close();
119-
* print(other.closed()); // 'true'
119+
* print(other.closed); // 'true'
120120
*
121-
* window.location('http://www.mysite.com', 'foo');
121+
* var newLocation = window.location
122+
* ..href = 'http://www.mysite.com';
123+
* window.location = newLocation;
122124
* // Does not close this window, as the history has changed.
123125
* window.close();
124-
* print(window.closed()); // 'false'
126+
* print(window.closed); // 'false'
125127
*
126128
* See also:
127129
*

tools/dom/templates/html/impl/impl_Window.darttemplate

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ $(CLASS_MODIFIERS)class $CLASSNAME$EXTENDS$IMPLEMENTS {
7676
// TODO: consider forcing users to do: window.location.assign('string').
7777
/**
7878
* Sets the window's location, which causes the browser to navigate to the new
79-
* location. [value] may be a Location object or a String.
79+
* location.
8080
*/
8181
set location(value) {
8282
_location = value;

0 commit comments

Comments
 (0)