HTML Standard Tracker

Filter

File a bug

SVNBugCommentTime (UTC)
1998define what happens when you set onclick='' on a document outside a Window2008-08-05 07:51
@@ -29701,22 +29701,25 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
 
   <p class="big-issue">We need to define how to handle events that are
   to be fired on a Document that is no longer the active document of
   its browsing context, and for Documents that have no browsing
   context. Do the events fire? Do the handlers in that document not
   fire? Do we just define scripting to be disabled when the document
   isn't active, with events still running as is? See also the
   <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>
 
   <p>Each event handler attribute has two parts, an <span title="event
   handler content attributes">event handler content attribute</span>
   and an <span title="event handler DOM attributes">event handler DOM
   attribute</span>. Event handler attributes must initially be set to
   null. When their value changes (through the changing of their event
   handler content attribute or their event handler DOM attribute),
@@ -29727,46 +29730,53 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
   <code>Window</code>, only have <span title="event handler DOM
   attributes">event handler DOM attribute</span> (since they have no
   content attributes).</p>
 
   <p><dfn>Event handler content attributes</dfn>, when specified, must
   contain valid ECMAScript code matching the ECMAScript <code
   title="">FunctionBody</code> production. <a
   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
   href="#refsECMA262">[ECMA262]</a></p>
 
   <p>The <span>script execution context</span> of the event handler
   must be the <code>Window</code> object at the end of the scope
   chain. The <span>script document context</span> of the event handler
   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
   corresponding event handler attribute to their new value, and on
   getting, must return whatever the current value of the corresponding
   event handler attribute is (possibly null).</p>
 
   <p>The following are the event handler attributes that must be
   supported by all <span>HTML elements</span>, as both content
   attributes and DOM attributes, and on <code>Window</code> objects,

|