with and scope chain augmentation
brendan at mozilla.com
Wed Jun 24 12:02:54 PDT 2009
On Jun 24, 2009, at 11:38 AM, Mike Wilson wrote:
> Jason Orendorff wrote:
>> Eeuuurgh. In that case, what David-Sarah said.
> What did he say?
He said "don't do that", to paraphrase. Full quote:
"The 'with' can be in non-strict code, which is perfectly
adequate for implementing a backward-compatible misfeature
(the peculiar scope chain of a DOM0 event handler)."
The nested DOM object scopes for event handlers was something I did to
allow brevity in inline event handler code. On balance it was a
mistake, but it was so popular that the VXML spec actually goes nuts
and reifies nested XML tags as objects on the scope chain for its ES
This makes for a confusing tower of scopes. You can't always see the
bindings, since an XML or HTML doc can be large. With the DOM, pieces
of the namespace can be bound implicitly or in obscure ways. And
So yeah: "don't do that" (don't use strict mode for any with hacks
that emulate bad old web APIs such as event handler scope).
Or to shorten it further a la jorendorff: Eeuuurgh.
More information about the es-discuss