HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
2596window.close(), window.focus(), window.blur().2008-12-28 06:16
@@ -37712,20 +37712,23 @@ explain that only direct children of the <menu> matter
   <pre class="idl">[NoInterfaceObject, IndexGetter]
 interface <dfn>Window</dfn> {
   // the current browsing context
   readonly attribute <span>Window</span> <span title="dom-window">window</span>;
   readonly attribute <span>Window</span> <span title="dom-self">self</span>;
            attribute DOMString <span title="dom-name">name</span>;
   [PutForwards=href] readonly attribute <span>Location</span> <span title="dom-document-location">location</span>;
   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>;
   readonly attribute unsigned long <span title="dom-length">length</span>;
   readonly attribute <span>Window</span> <span title="dom-top">top</span>;
   readonly attribute <span>Window</span> <span title="dom-opener">opener</span>;
   readonly attribute <span>Window</span> <span title="dom-parent">parent</span>;
   readonly attribute <span>Element</span> <span title="dom-frameElement">frameElement</span>;
   <span>Window</span> <span title="dom-open">open</span>();
   <span>Window</span> <span title="dom-open">open</span>(in DOMString url);
@@ -37792,21 +37795,20 @@ interface <dfn>Window</dfn> {
            attribute <span>EventListener</span> <span title="handler-onunload">onunload</span>;
 };
 
 // <dfn class="XXX">VoidCallback</dfn> waiting on WebIDL
 </pre>
 
  <!-- XXX http://msdn.microsoft.com/workshop/author/dhtml/reference/objects/obj_window.asp
           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
   title="dom-frames"><code>frames</code></dfn>, and <dfn
   title="dom-self"><code>self</code></dfn> DOM attributes must all
   return the <code>Window</code> object itself.</p>
 
   <p>The <code>Window</code> object also provides the scope for <span title="concept-script">script</span>
   execution. Each <code>Document</code> in a <span>browsing
   context</span> has an associated <dfn>list of added properties</dfn>
@@ -37924,20 +37926,32 @@ interface <dfn>Window</dfn> {
   navigated, or null if no browsing context was navigated.</p>
 
   <p>The <dfn title="dom-name"><code>name</code></dfn> attribute of
   the <code>Window</code> object must, on getting, return the current
   name of the <span>browsing context</span>, and, on setting, set the
   name of the <span>browsing context</span> to the new value.</p>
 
   <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>
 
   <p>The <dfn title="dom-length"><code>length</code></dfn> DOM
   attribute on the <code>Window</code> interface must return the
   number of <span title="child browsing context">child browsing
   contexts</span> of the <span title="active document">active</span>
   <code>Document</code>.</p>
 
@@ -40006,20 +40020,24 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   value</dfn>. The <span>return value</span> of a browsing context
   must be initialized to the empty string when the browsing context is
   created.</p>
 
   <p>The <dfn
   title="dom-modalWindow-returnValue"><code>returnValue</code></dfn>
   DOM attribute, on getting, must return the <span>return value</span>
   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>
 
 <!-- v2 feature requests:
 
    - ability to snooze a notification so it comes again later
       - shouldn't be on all messages, only those for which it makes
         sense
       - possibly just provide a new argument that takes an array of
         (label, callback) tuples so that sites can implement this
@@ -46679,29 +46697,26 @@ at the first element with the given ID must be treated as if it was cloned and r
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%20%0A...%3Cform%3E%3Cinput%20name%3Da%20onfocus%3D%22value%2B%3D1%3Bd.name%3D%27a%27%3Bname%3D%27d%27%3Bb.focus()%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22value%2B%3D1%3Bc.focus()%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22value%2B%3D1%3Bd.focus()%22%3E%0A%3Cinput%20name%3Dd%20onfocus%3D%22value%2B%3D1%3Ba.focus()%22%3E -->
 
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af1%20%27%3Bb.focus()%3Balert(document.activeElement.name)%3Bt.value%2B%3D%27af2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E%0A%3Cinput%20name%3Dc%20onfocus%3D%22t.value%2B%3D%27cf1%20%27%3Bc.focus()%3Bt.value%2B%3D%27cf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27cb%20%27%3B%22%3E%0A -->
 
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%20onload%3D%22document.forms%5B0%5D.a.focus()%22%3E%0A...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onblur%3D%22t.value%2B%3D'ab%20'%3B%20b.focus()%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D'bf1%20'%3Ba.focus()%3Bt.value%2B%3D'bf2%20'%3B%22%20onblur%3D%22t.value%2B%3D'bb%20'%3B%22%3E -->
 
   <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%3Cbody%3E...%3Cform%3E%0A%3Ctextarea%20name%3Dt%20cols%3D100%20rows%3D3%3E%3C%2Ftextarea%3E%3Cp%3E%0A%3Cinput%20name%3Da%20onfocus%3D%22t.value%2B%3D%27af%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27ab1%20%27%3Bb.focus()%3Bt.value%2B%3D%27ab2%20%27%3B%22%3E%0A%3Cinput%20name%3Db%20onfocus%3D%22t.value%2B%3D%27bf1%20%27%3Ba.focus()%3Bt.value%2B%3D%27bf2%20%27%3B%22%20onblur%3D%22t.value%2B%3D%27bb%20%27%3B%22%3E -->
 
   <!-- 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
   document must be targeted at that element. There may be no element
   focused; when no element is focused, key events received by the
   document must be targetted at <span>the <code>body</code>
   element</span>.</p>
 
   <p>User agents may track focus for each <span>browsing
   context</span> or <code>Document</code> individually, or may support
@@ -46903,31 +46918,59 @@ at the first element with the given ID must be treated as if it was cloned and r
 
   <p>User agents should run the <span>unfocusing steps</span> for an
   element whenever the user moves the focus away from any
   <span>focusable</span> element.</p>
 
 
   <h4>Document-level focus APIs</h4>
 
   <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>
 
   <p>The <dfn title="dom-focus"><code>focus()</code></dfn> method,
   when invoked, must run the following algorithm:</p>
 
   <ol>
 
    <li><p>If the element is marked as <i>locked for focus</i>, then abort

|