Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(469)

Side by Side Diff: sdk/lib/html/src/CrossFrameTypes.dart

Issue 11416081: Added a lot more documentation to Window. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated with changes to some docs. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of html; 5 part of html;
6 6
7 /** 7 /**
8 * An object representing the top-level context object for web scripting. 8 * An object representing the top-level context object for web scripting.
9 * 9 *
10 * In a web browser, a [Window] object represents the actual browser window. 10 * In a web browser, a [Window] object represents the actual browser window.
11 * In a multi-tabbed browser, each tab has its own [Window] object. A [Window] 11 * In a multi-tabbed browser, each tab has its own [Window] object. A [Window]
12 * is the container that displays a [Document]'s content. All web scripting 12 * is the container that displays a [Document]'s content. All web scripting
13 * happens within the context of a [Window] object. 13 * happens within the context of a [Window] object.
14 * 14 *
15 * **Note:** This class represents any window, whereas [LocalWindow] is 15 * **Note:** This class represents any window, whereas [LocalWindow] is
16 * used to access the properties and content of the current window. 16 * used to access the properties and content of the current window.
17 * 17 *
18 * See also: 18 * See also:
19 * 19 *
20 * * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN. 20 * * [DOM Window](https://developer.mozilla.org/en-US/docs/DOM/window) from MDN.
21 * * [Window](http://www.w3.org/TR/Window/) from the W3C. 21 * * [Window](http://www.w3.org/TR/Window/) from the W3C.
22 */ 22 */
23 abstract class Window { 23 abstract class Window {
24 // Fields. 24 // Fields.
25
26 /**
27 * The current location of this window.
28 *
29 * Location currentLocation = window.location;
30 * print(currentLocation.href); // 'http://www.example.com:80/'
31 */
25 Location get location; 32 Location get location;
26 History get history; 33 History get history;
27 34
35 /**
36 * Indicates whether this window is closed.
37 *
38 * print(window.closed); // 'false'
39 * window.close();
40 * print(window.closed); // 'true'
41 */
28 bool get closed; 42 bool get closed;
43
44 /**
45 * A reference to the [Window] that opened this one.
Kathy Walrath 2012/11/20 01:51:24 Again, [Window] -> window. (I'm not sure whether x
Andrei Mouravski 2012/11/20 06:28:47 Done.
46 *
47 * Window thisWindow = window;
48 * Window otherWindow = thisWindow.open('http://www.example.com/', 'foo');
49 * print(otherWindow.opener == thisWindow); // 'true'
50 */
29 Window get opener; 51 Window get opener;
52
53 /**
54 * A reference to the parent of this window.
55 *
56 * If this [Window] has no parent, [parent] will return a reference to
57 * the [Window] itself.
58 *
59 * IFrameElement myIFrame = new IFrameElement();
60 * window.document.body.elements.add(myIFrame);
61 * print(myIframe.contentWindow.parent == window) // 'true'
62 *
63 * print(window.parent == window) // 'true'
64 */
30 Window get parent; 65 Window get parent;
66
67 /**
68 * A reference to the topmost window in the window heirarchy.
Kathy Walrath 2012/11/20 01:51:24 heirarchy -> hierarchy (Tough word to spell. I h
69 *
70 * If this [Window] is the topmost [Window], [top] will return a reference to
71 * the [Window] itself.
72 *
73 * // Add an IFrame to the current window.
74 * IFrameElement myIFrame = new IFrameElement();
75 * window.document.body.elements.add(myIFrame);
76 *
77 * // Add an IFrame inside of the other IFrame.
78 * IFrameElement innerIFrame = new IFrameElement();
79 * myIFrame.elements.add(innerIFrame);
80 *
81 * print(myIframe.contentWindow.top == window) // 'true'
82 * print(innerIFrame.contentWindow.top == window) // 'true'
83 *
84 * print(window.top == window) // 'true'
85 */
31 Window get top; 86 Window get top;
32 87
33 // Methods. 88 // Methods.
34 void focus(); 89 void focus();
35 void blur(); 90 void blur();
36 void close(); 91 void close();
37 void postMessage(var message, String targetOrigin, [List messagePorts = null]) ; 92 void postMessage(var message, String targetOrigin, [List messagePorts = null]) ;
38 } 93 }
39 94
40 abstract class Location { 95 abstract class Location {
41 void set href(String val); 96 void set href(String val);
42 } 97 }
43 98
44 abstract class History { 99 abstract class History {
45 void back(); 100 void back();
46 void forward(); 101 void forward();
47 void go(int distance); 102 void go(int distance);
48 } 103 }
OLDNEW
« no previous file with comments | « sdk/lib/html/dartium/html_dartium.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698