[html5] r1998 - [] (0) define what happens when you set onclick='' on a document outside a Window

whatwg at whatwg.org whatwg at whatwg.org
Tue Aug 5 00:51:18 PDT 2008


Author: ianh
Date: 2008-08-05 00:51:18 -0700 (Tue, 05 Aug 2008)
New Revision: 1998

Modified:
   index
   source
Log:
[] (0) define what happens when you set onclick='' on a document outside a Window

Modified: index
===================================================================
--- index	2008-08-05 06:35:46 UTC (rev 1997)
+++ index	2008-08-05 07:51:18 UTC (rev 1998)
@@ -32447,6 +32447,7 @@
 
   <h5 id=event-handler-attributes><span class=secno>5.4.4.1. </span>Event
    handler attributes</h5>
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E -->
 
   <p><a href="#html-elements">HTML elements</a> can have <dfn id=event2>event
    handler attributes</dfn> specified. These act as bubbling event listeners
@@ -32472,12 +32473,13 @@
    href="#refsECMA262">[ECMA262]</a></p>
   <!-- SCRIPT EXEC -->
 
-  <p>When an event handler content attribute is set, its new value must be
-   interpreted as the body of an anonymous function with a single argument
-   called <code>event</code>, with the new function's scope chain being
-   linked from the activation object of the handler, to the element, to the
-   element's <code>form</code> element if it is a form control, to the
-   <code>Document</code> object, to the <code><a
+  <p>When an event handler content attribute is set, if the element is owned
+   by a <code>Document</code> that is in a <a href="#browsing1">browsing
+   context</a>, its new value must be interpreted as the body of an anonymous
+   function with a single argument called <code>event</code>, with the new
+   function's scope chain being linked from the activation object of the
+   handler, to the element, to the element's <code>form</code> element if it
+   is a form control, to the <code>Document</code> object, to the <code><a
    href="#window">Window</a></code> object of the <a
    href="#browsing1">browsing context</a> of that <code>Document</code>. The
    function's <code>this</code> parameter must be the <code>Element</code>
@@ -32497,6 +32499,10 @@
    event handler must be the <code>Document</code> object that owns the event
    handler content attribute that was set.
 
+  <p>When an event handler content attribute is set on an element owned by a
+   <code>Document</code> that is not in a <a href="#browsing1">browsing
+   context</a>, the corresponding event handler attribute is not changed.
+
   <p class=big-issue>How do we allow non-JS event handlers?
 
   <p><dfn id=event4>Event handler DOM attributes</dfn>, on setting, must set

Modified: source
===================================================================
--- source	2008-08-05 06:35:46 UTC (rev 1997)
+++ source	2008-08-05 07:51:18 UTC (rev 1998)
@@ -29708,8 +29708,11 @@
   <code>script</code> element section, which says scripts don't run
   when the document isn't active.</p>
 
+
   <h5 id="event-handler-attributes">Event handler attributes</h5>
 
+  <!-- http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C!DOCTYPE%20html%3E%0A...%3Cscript%3E%0Aw(a%3Ddocument.implementation.createDocument(null%2C%20null%2C%20null))%3B%0Aw(a.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'html')))%3B%0Aw(b%3Da.firstChild.appendChild(a.createElementNS('http%3A%2F%2Fwww.w3.org%2F1999%2Fxhtml'%2C%20'body')))%3B%0Aw(b.test%20%3D%20w)%3B%0Aw(b.setAttribute('onclick'%2C%20'test(%22fire%3A%20%22%20%2B%20event)'))%3B%0Aw(b.onclick)%3B%0Aw(e%3Da.createEvent('Event'))%3B%0Aw(e.initEvent('click'%2C%20false%2C%20false))%3B%0Aw(b.dispatchEvent(e))%3B%0A%3C%2Fscript%3E -->
+
   <p><span>HTML elements</span> can have <dfn>event handler
   attributes</dfn> specified. These act as bubbling event listeners
   for the element on which they are specified.</p>
@@ -29734,21 +29737,23 @@
   href="#refsECMA262">[ECMA262]</a></p>
 
   <!-- SCRIPT EXEC -->
-  <p>When an event handler content attribute is set, its new value
-  must be interpreted as the body of an anonymous function with a
-  single argument called <code>event</code>, with the new function's
-  scope chain being linked from the activation object of the handler,
-  to the element, to the element's <code>form</code> element if it is
-  a form control, to the <code>Document</code> object, to the
-  <code>Window</code> object of the <span>browsing context</span> of
-  that <code>Document</code>. The function's <code>this</code>
-  parameter must be the <code>Element</code> object representing the
-  element. The resulting function must then be set as the value of the
-  corresponding event handler attribute, and the new value must be set
-  as the value of the content attribute. If the given function body
-  fails to compile, then the corresponding event handler attribute
-  must be set to null instead (the content attribute must still be
-  updated to the new value, though).</p>
+  <p>When an event handler content attribute is set, if the element is
+  owned by a <code>Document</code> that is in a <span>browsing
+  context</span>, its new value must be interpreted as the body of an
+  anonymous function with a single argument called <code>event</code>,
+  with the new function's scope chain being linked from the activation
+  object of the handler, to the element, to the element's
+  <code>form</code> element if it is a form control, to the
+  <code>Document</code> object, to the <code>Window</code> object of
+  the <span>browsing context</span> of that <code>Document</code>. The
+  function's <code>this</code> parameter must be the
+  <code>Element</code> object representing the element. The resulting
+  function must then be set as the value of the corresponding event
+  handler attribute, and the new value must be set as the value of the
+  content attribute. If the given function body fails to compile, then
+  the corresponding event handler attribute must be set to null
+  instead (the content attribute must still be updated to the new
+  value, though).</p>
 
   <p class="note">See ECMA262 Edition 3, sections 10.1.6 and 10.2.3,
   for more details on activation objects. <a
@@ -29760,6 +29765,11 @@
   must be the <code>Document</code> object that owns the event handler
   content attribute that was set.</p>
 
+  <p>When an event handler content attribute is set on an element
+  owned by a <code>Document</code> that is not in a <span>browsing
+  context</span>, the corresponding event handler attribute is not
+  changed.</>
+
   <p class="big-issue">How do we allow non-JS event handlers?</p>
 
   <p><dfn>Event handler DOM attributes</dfn>, on setting, must set the




More information about the Commit-Watchers mailing list