Permalink
Browse files

[] (0) define what happens when you set onclick='' on a document outs…

…ide a Window

git-svn-id: http://svn.whatwg.org/webapps@1998 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information...
1 parent db91f84 commit d1ad4372da70f32f2809cc6036bf682e3e67755a @Hixie Hixie committed Aug 5, 2008
Showing with 37 additions and 21 deletions.
  1. +12 −6 index
  2. +25 −15 source
View
18 index
@@ -32447,6 +32447,7 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<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 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
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 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
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
View
40 source
@@ -29708,8 +29708,11 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
<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 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
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 @@ JSURL: http://ietfreport.isoc.org/all-ids/draft-hoehrmann-javascript-scheme-00.t
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

0 comments on commit d1ad437

Please sign in to comment.