- From: Allen Wirfs-Brock <allen@wirfs-brock.com>
- Date: Thu, 3 Feb 2011 15:32:05 -0800
- To: Garrett Smith <dhtmlkitchen@gmail.com>
- Cc: EcmaScript <es-discuss@mozilla.org>, public-script-coord@w3.org
Regarding the call language, it would probably be best if it was described in terms of invoking the [[Call]] internal method of the handler's function object. However, that might be unnecessary if if the WebIDL ECMASCript binding makes it clear that the effect of invoking the call method of the Function interface is defined in terms of [[Call]]. We may have clashing spec. terminology here but I think the intent seems clear enough. Allen On Feb 3, 2011, at 2:16 PM, Garrett Smith wrote: > On 2/3/11, Allen Wirfs-Brock <allen@wirfs-brock.com> wrote: >> I was browsing Kangax's strict mode test result page >> (http://kangax.github.com/es5-compat-table/strict-mode/ ) and I noticed that >> he listed the recognition of a use strict directive of a event handler as a >> "non-standard" feature that he tests for. > > javascript: void(document.body.setAttribute("onclick", "'use > strict;'\nalert(this);")); alert(document.body.onclick); > >> >> To be sure, I checked the event handler section of the HTML5 spec >> (http://dev.w3.org/html5/spec/Overview.html#event-handler-attributes) and to >> my surprise I discovered that it specifies the creation of the handler >> function in a manner that, at first glance, seems to explicitly cause the >> presence of a use strict directive to be ignored. Essentially it seems to >> specify that event handlers specified using the event handler attribute are >> never executed in ECMAScript 5 strict mode. I don't know whether or not >> this was intentional, but it certainly seems wrong. The "strictness" of an >> ECMAScript function is an internal and local characteristic of the function. >> For a ECMAScript host to say that a use strict directive is ignored is >> really no different from saying that IfStatements or any other >> syntactically valid element of a FunctionBody will be ignored. >> >> The HTML5 spec. get into this trouble because of the way it uses the >> abstract operation for creating function objects defined by section 13.2 of >> the ES5 specification > > HTML 5 also specifies that the function's `call` callback is called > when in fact that does not happen at all. > <http://dev.w3.org/html5/spec/Overview.html#event-handler-content-attributes> > > "When an event handler's Function object is invoked, its call() > callback must be invoked with one argument, set to the Event object of > the event in question." > > Instead, it should say something like when the event handler is > invoked, the callback function is called. > > And to add to that D3E should say (and it has been agreed upon) that > the `this` value (cntext) for callbacks oef event handlers is set to > be the current target object. > > Sprruy, I have only scanned and skimmed cause I'm too damn lazy :-D. > But would there be any problems with doing things like that, Allen? > -- > Garrett
Received on Friday, 4 February 2011 14:11:57 UTC