Message from discussion
closures, what are they good for?
Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail
From: "Richard Cornford" <Rich...@litotes.demon.co.uk>
Newsgroups: comp.lang.javascript
Subject: Re: closures, what are they good for?
Date: Mon, 16 Jun 2003 17:28:44 +0100
Lines: 39
Message-ID: <bckr7t$r7j$1$830fa7a5@news.demon.co.uk>
References: <8d54528badb2f585a37b76c4c3e19694@news.teranews.com> <b843v5$lfi$1$8302bc10@news.demon.co.uk> <290e65a0.0304231822.2252d0ce@posting.google.com> <b88qbm$7jd$1$8300dec7@news.demon.co.uk> <290e65a0.0304250911.6a7b8e55@posting.google.com> <b8dshd$d46$1$8302bc10@news.demon.co.uk> <d2d855ea.0304270902.7f84ffa9@posting.google.com> <b8n85r$isn$1$8302bc10@news.demon.co.uk> <3eaf838f.559674218@news.cis.dfn.de>
NNTP-Posting-Host: litotes.demon.co.uk
X-Trace: news.demon.co.uk 1055780926 27891 212.229.126.254 (16 Jun 2003 16:28:46 GMT)
X-Complaints-To: abuse@demon.net
NNTP-Posting-Date: Mon, 16 Jun 2003 16:28:46 +0000 (UTC)
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
X-Priority: 3
X-Newsreader: Microsoft Outlook Express 6.00.2800.1106
X-MSMail-Priority: Normal
"Jim Ley" <j...@jibbering.com> wrote in message
news:3eaf838f.559674218@news.cis.dfn.de...
<snip>
>>>...therefore, nothing which cannot be achieved by regular
>>>expando properties.
>>
>>
>>My thoughts until Jim raised the potential problems with Java based
>>browsers. But I still haven't tested how significant his concerns
>>actually are.
>
>I only know of it in Batik's Squiggle (which is an SVG viewer, not, an
>HTML one) it's also relatively easy to implement if using Rhino , so I
>don't think it's a major concern, the Batik people unfortunately did a
>static implementation first - no javascript - so changing all the Node
>types to inherit from the js objects was more effort.
At the time you also mentioned Ice Storm as potentially having a
problem. I have recently been testing IceBrowser 5.4.1 (looks like they
have dropped Ice Storm as a name) and have confirmed that it mostly does
not have a problem with letting JavaScript add properties to its DOM
elements. It does follow IE in creating attribute elements for any
properties added to a DOM element with JavaScript.
I did find two objects that would not allow properties to be added with
JavaScript and in both cases the result of attempting to do so was to
crash the browser (tested within try/catch so it was not just an
uncaught exception). The first was - document.selection - which is not a
big problem as there is no good reason to be adding properties to that
object. The other was the object referenced with - defaultView - . On
gecko browsers the defaultView property is a reference to a window
object, therefor a global object to which properties can be added. On
IceBrowser 5 - defaultView - is a very different object, containing what
are clearly Java methods and objects (e.g. class, notifyAll, hashCode,
wait, etc.).
Richard.