cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pier Fumagalli <>
Subject Re: Discussion of Flow Issues
Date Mon, 17 Mar 2003 23:57:57 GMT
On 17/3/03 20:02, "Stefano Mazzocchi" <> wrote:

>> I share your "attach-a-method-to-an-object" concern, which certainly
>> comes from our heavy Java background.
> I'm sure it does, but after playing pretty hard with javascript for
> DHTML, I can tell you that the hardest thing for me to graps is the
> concept of why everybody uses
> alert("blah")
> why they use
> window.status = "blah"
> but never
> window.alert("blah");
> and
> status = "blah";
> In my mind, this means that not many understand that the 'window' object
> is transparently mapped to the global unnamespaced object.... but it
> creates a mess because you could have 'status' defined in your scripts
> as well.
> This is why I want a clean unnamespaced object.
> I would not mind log methods such as
> info("blah");
> error("blah");
> debug("lkj");
> but that should be it.

Well.. The "global" can also be referred to as "this"... So you can also



That said, I believe that the best way to define global operations and
attributes is to define them in a so called "script" object, whose instance
is the one you're going to call from the sitemap...

So, "cocoon.sendPage()" becomes "this.cocoon.sendPage()"... JavaScript, as
Java, allows you to strip out the "this."...


View raw message