with and scope chain augmentation

Mike Wilson mikewse at hotmail.com
Wed Jun 24 12:16:36 PDT 2009

Brendan Eich wrote:
> 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)."

Thanks. I seem to have missed this reply. Where did it appear?

> 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 scripting model!

I'm sure many agree it is a confusing feature that is best 
not depended upon, but well the topic here was emulating the 
browser in pure JS. Anyway, if |with| will always be available in 
non-strict code, well, I guess it's no problem.

BTW, the DOM0 scope chain augmentation is now finally being 
specified for all time, as of HTML5:

Best regards

More information about the es-discuss mailing list