Browse files

[] (0) window.close(), window.focus(), window.blur().

git-svn-id: http://svn.whatwg.org/webapps@2596 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent 61efebd commit 8001668d8052f746264bd256a6939900c40f65bf @Hixie Hixie committed Dec 28, 2008
Showing with 109 additions and 29 deletions.
  1. +52 −15 index
  2. +57 −14 source
View
67 index
@@ -21,7 +21,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML 5</h1>
- <h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 27 December 2008</h2>
+ <h2 class="no-num no-toc" id=draft-recommendation-&mdash;-date:-01-jan-1901>Draft Recommendation &mdash; 28 December 2008</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<dl><dt>Multiple-page version:</dt>
@@ -33212,6 +33212,9 @@ interface <dfn id=window>Window</dfn> {
readonly attribute <a href=#history-1>History</a> <a href=#dom-history title=dom-history>history</a>;
readonly attribute <a href=#undomanager>UndoManager</a> <a href=#dom-undomanager title=dom-undoManager>undoManager</a>;
<a href=#selection-0>Selection</a> <a href=#dom-getselection title=dom-getSelection>getSelection</a>();
+ void <a href=#dom-window-close title=dom-window-close>close</a>();
+ void <a href=#dom-window-focus title=dom-window-focus>focus</a>();
+ void <a href=#dom-window-blur title=dom-window-blur>blur</a>();
// other browsing contexts
readonly attribute <a href=#window>Window</a> <a href=#dom-frames title=dom-frames>frames</a>;
@@ -33292,7 +33295,6 @@ interface <dfn id=window>Window</dfn> {
http://www.mozilla.org/docs/dom/domref/dom_window_ref.html
http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindow.idl - scrollBy, etc
http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindowInternal.idl - DOM level 0
- close() focus() blur() - when defining close(), mention it in showModalDialog() as a way to close the window
-->
<p>The <dfn id=dom-window title=dom-window><code>window</code></dfn>, <dfn id=dom-frames title=dom-frames><code>frames</code></dfn>, and <dfn id=dom-self title=dom-self><code>self</code></dfn> DOM attributes must all
@@ -33412,6 +33414,17 @@ interface <dfn id=window>Window</dfn> {
<p class=note>The name <a href=#resetBCName>gets reset</a> when
the browsing context is navigated to another domain.</p>
+ <p>The <dfn id=dom-window-close title=dom-window-close><code>close()</code></dfn>
+ method on <code><a href=#window>Window</a></code> objects should, if the corresponding
+ <a href=#browsing-context>browsing context</a> <var title="">A</var> is an
+ <a href=#auxiliary-browsing-context>auxiliary browsing context</a> that was created by a script
+ (as opposed to by an action of the user), and if the <a href="#script's-browsing-context" title="script's browsing context">browsing context</a> of the
+ <a href=#concept-script title=concept-script>script</a> that invokes the method
+ is <a href=#allowed-to-navigate>allowed to navigate</a> the <a href=#browsing-context>browsing
+ context</a> <var title="">A</var>, close the <a href=#browsing-context>browsing
+ context</a> <var title="">A</var> (and may <a href=#a-browsing-context-is-discarded title="a
+ browsing context is discarded">discard</a> it too).</p>
+
<h4 id=accessing-other-browsing-contexts><span class=secno>5.2.3 </span>Accessing other browsing contexts</h4>
@@ -35184,6 +35197,9 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
of its browsing context, and on setting, must set the <a href=#return-value>return
value</a> to the given new value.</p>
+ <p class=note>The <code title=dom-window-close><a href=#dom-window-close>window.close()</a></code> method can be used to
+ close the browsing context.</p>
+
<h4 id=notifications><span class=secno>5.5.4 </span>Notifications</h4>
@@ -40993,15 +41009,12 @@ at the first element with the given ID must be treated as if it was cloned and r
<!-- XXX
- define onfocus/onblur behaviour for Window
- - Other things to look at are IE's focus APIs (document.activeElement,
- document.hasFocus, HTMLElement.setActive(), onBeforeActivate,
- onActivate, onBeforeDeactivate, onDeactivate, document.hasFocus):
+ - Other things to look at are IE's focus APIs (HTMLElement.setActive(),
+ onBeforeActivate, onActivate, onBeforeDeactivate, onDeactivate):
https://bugzilla.mozilla.org/show_bug.cgi?id=296471
https://bugzilla.mozilla.org/show_bug.cgi?id=296469
- http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/activeelement.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setactive.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeactivate.asp
- http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/focus.asp
-->
<p>When an element is <i>focused</i>, key events received by the
@@ -41186,16 +41199,40 @@ at the first element with the given ID must be treated as if it was cloned and r
<h4 id=document-level-focus-apis><span class=secno>6.5.3 </span>Document-level focus APIs</h4>
<p>The <dfn id=dom-document-activeelement title=dom-document-activeElement><code>activeElement</code></dfn>
- attribute must return the element in the document that is
- focused. If no element in the <code>Document</code> is focused, this
- must return <a href=#the-body-element-1>the <code>body</code> element</a>.</p>
+ attribute on <code>DocumentHTML</code> objects must return the
+ element in the document that is focused. If no element in the
+ <code>Document</code> is focused, this must return <a href=#the-body-element-1>the
+ <code>body</code> element</a>.</p>
<p>The <dfn id=dom-document-hasfocus title=dom-document-hasFocus><code>hasFocus()</code></dfn> method
- must return true if the document's <a href=#browsing-context>browsing context</a> is
- focused, and all its <a href=#ancestor-browsing-context title="ancestor browsing
- context">ancestor browsing contexts</a> are also focused, and the
- <a href=#top-level-browsing-context>top-level browsing context</a> has the <i>system
- focus</i>.</p>
+ on <code>DocumentHTML</code> objects must return true if the
+ document's <a href=#browsing-context>browsing context</a> is focused, and all its
+ <a href=#ancestor-browsing-context title="ancestor browsing context">ancestor browsing
+ contexts</a> are also focused, and the <a href=#top-level-browsing-context>top-level browsing
+ context</a> has the <i>system focus</i>.</p>
+
+ <p>The <dfn id=dom-window-focus title=dom-window-focus><code>focus()</code></dfn>
+ method on the <code><a href=#window>Window</a></code> object, when invoked, provides a
+ hint to the user agent that the script believes the user might be
+ interested in the contents of the <a href=#browsing-context>browsing context</a> of
+ the <code><a href=#window>Window</a></code> object on which the method was invoked.</p>
+
+ <p>User agents are encouraged to have this <code title=dom-window-blur><a href=#dom-window-blur>focus()</a></code> method trigger some kind of
+ notification.</p>
+
+ <p>The <dfn id=dom-window-blur title=dom-window-blur><code>blur()</code></dfn> method
+ on the <code><a href=#window>Window</a></code> object, when invoked, provides a hint to
+ the user agent that the script believes the user probably is not
+ currently interested in the contents of the <a href=#browsing-context>browsing
+ context</a> of the <code><a href=#window>Window</a></code> object on which the method
+ was invoked, but that the contents might become interesting again in
+ the future.</p>
+
+ <p>User agents are encouraged to ignore calls to this <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> method entirely.</p>
+
+ <p class=note>Historically the <code title=dom-window-blur><a href=#dom-window-blur>focus()</a></code> and <code title=dom-window-blur><a href=#dom-window-blur>blur()</a></code> methods actually affected the
+ system focus, but hostile sites widely abuse this behavior to the
+ user's detriment.</p>
<h4 id=element-level-focus-apis><span class=secno>6.5.4 </span>Element-level focus APIs</h4>
View
71 source
@@ -37719,6 +37719,9 @@ interface <dfn>Window</dfn> {
readonly attribute <span>History</span> <span title="dom-history">history</span>;
readonly attribute <span>UndoManager</span> <span title="dom-undoManager">undoManager</span>;
<span>Selection</span> <span title="dom-getSelection">getSelection</span>();
+ void <span title="dom-window-close">close</span>();
+ void <span title="dom-window-focus">focus</span>();
+ void <span title="dom-window-blur">blur</span>();
// other browsing contexts
readonly attribute <span>Window</span> <span title="dom-frames">frames</span>;
@@ -37799,7 +37802,6 @@ interface <dfn>Window</dfn> {
http://www.mozilla.org/docs/dom/domref/dom_window_ref.html
http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindow.idl - scrollBy, etc
http://lxr.mozilla.org/mozilla/source/dom/public/idl/base/nsIDOMWindowInternal.idl - DOM level 0
- close() focus() blur() - when defining close(), mention it in showModalDialog() as a way to close the window
-->
<p>The <dfn title="dom-window"><code>window</code></dfn>, <dfn
@@ -37931,6 +37933,18 @@ interface <dfn>Window</dfn> {
<p class="note">The name <a href="#resetBCName">gets reset</a> when
the browsing context is navigated to another domain.</p>
+ <p>The <dfn title="dom-window-close"><code>close()</code></dfn>
+ method on <code>Window</code> objects should, if the corresponding
+ <span>browsing context</span> <var title="">A</var> is an
+ <span>auxiliary browsing context</span> that was created by a script
+ (as opposed to by an action of the user), and if the <span
+ title="script's browsing context">browsing context</span> of the
+ <span title="concept-script">script</span> that invokes the method
+ is <span>allowed to navigate</span> the <span>browsing
+ context</span> <var title="">A</var>, close the <span>browsing
+ context</span> <var title="">A</var> (and may <span title="a
+ browsing context is discarded">discard</span> it too).</p>
+
<h4>Accessing other browsing contexts</h4>
@@ -40013,6 +40027,10 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
of its browsing context, and on setting, must set the <span>return
value</span> to the given new value.</p>
+ <p class="note">The <code
+ title="dom-window-close">window.close()</code> method can be used to
+ close the browsing context.</p>
+
<h4>Notifications</h4>
@@ -46686,15 +46704,12 @@ at the first element with the given ID must be treated as if it was cloned and r
<!-- XXX
- define onfocus/onblur behaviour for Window
- - Other things to look at are IE's focus APIs (document.activeElement,
- document.hasFocus, HTMLElement.setActive(), onBeforeActivate,
- onActivate, onBeforeDeactivate, onDeactivate, document.hasFocus):
+ - Other things to look at are IE's focus APIs (HTMLElement.setActive(),
+ onBeforeActivate, onActivate, onBeforeDeactivate, onDeactivate):
https://bugzilla.mozilla.org/show_bug.cgi?id=296471
https://bugzilla.mozilla.org/show_bug.cgi?id=296469
- http://msdn.microsoft.com/workshop/author/dhtml/reference/properties/activeelement.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/setactive.asp
http://msdn.microsoft.com/workshop/author/dhtml/reference/events/onbeforeactivate.asp
- http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/focus.asp
-->
<p>When an element is <i>focused</i>, key events received by the
@@ -46910,17 +46925,45 @@ at the first element with the given ID must be treated as if it was cloned and r
<p>The <dfn
title="dom-document-activeElement"><code>activeElement</code></dfn>
- attribute must return the element in the document that is
- focused. If no element in the <code>Document</code> is focused, this
- must return <span>the <code>body</code> element</span>.</p>
+ attribute on <code>DocumentHTML</code> objects must return the
+ element in the document that is focused. If no element in the
+ <code>Document</code> is focused, this must return <span>the
+ <code>body</code> element</span>.</p>
<p>The <dfn
title="dom-document-hasFocus"><code>hasFocus()</code></dfn> method
- must return true if the document's <span>browsing context</span> is
- focused, and all its <span title="ancestor browsing
- context">ancestor browsing contexts</span> are also focused, and the
- <span>top-level browsing context</span> has the <i>system
- focus</i>.</p>
+ on <code>DocumentHTML</code> objects must return true if the
+ document's <span>browsing context</span> is focused, and all its
+ <span title="ancestor browsing context">ancestor browsing
+ contexts</span> are also focused, and the <span>top-level browsing
+ context</span> has the <i>system focus</i>.</p>
+
+ <p>The <dfn title="dom-window-focus"><code>focus()</code></dfn>
+ method on the <code>Window</code> object, when invoked, provides a
+ hint to the user agent that the script believes the user might be
+ interested in the contents of the <span>browsing context</span> of
+ the <code>Window</code> object on which the method was invoked.</p>
+
+ <p>User agents are encouraged to have this <code
+ title="dom-window-blur">focus()</code> method trigger some kind of
+ notification.</p>
+
+ <p>The <dfn title="dom-window-blur"><code>blur()</code></dfn> method
+ on the <code>Window</code> object, when invoked, provides a hint to
+ the user agent that the script believes the user probably is not
+ currently interested in the contents of the <span>browsing
+ context</span> of the <code>Window</code> object on which the method
+ was invoked, but that the contents might become interesting again in
+ the future.</p>
+
+ <p>User agents are encouraged to ignore calls to this <code
+ title="dom-window-blur">blur()</code> method entirely.</p>
+
+ <p class="note">Historically the <code
+ title="dom-window-blur">focus()</code> and <code
+ title="dom-window-blur">blur()</code> methods actually affected the
+ system focus, but hostile sites widely abuse this behavior to the
+ user's detriment.</p>
<h4>Element-level focus APIs</h4>

0 comments on commit 8001668

Please sign in to comment.