[dev] [horde-soc] [cvs] commit: incubator/Horde_Form/js eventlistener.js

Chuck Hagenbuch chuck at horde.org
Sat Jul 30 22:17:36 PDT 2005


Quoting Matt Warden <mwarden at gmail.com>:

> I don't see where you're saying unobtrusive js is being violated.
> Further, addObjectEventListener is what I'm using to assign initBody
> to window.onload.

I guess I would lean away from the extra function then, but of course 
your way works as well.

> I've added code to optionally accept a string parameter instead of a
> function name. The code in horde/js/form_helpers.js uses regular
> expressions just to remove the initial 'on' in an "event" like
> 'onload'. The event in that instance is 'load'. Viewing things this
> way both makes things a little more correct and avoids the need to use
> the regular expression engine (although a simple substring() would
> ahve worked just as well).

A patch on form_helpers as a quick improvement for now would be great. 
I rewrote the whole function recently since it was entirely broken 
having been originally written to write directly to the "onfoo" 
attributes... :)

> It's very complicated. Jan suggested to use document.write() to add
> dependencies. There are other ways that avoid document.write(). This
> is one of the the things OpenJSAN (http://openjsan.org/) is working on
> right now, especially in trying to avoid circular depencies. I think
> they ended up using a server written in Perl to resolve the
> dependencies and write the correct <script> tags to output (just to
> give you an idea of how difficult and hackish it is to do such
> resolving on the client-side).

Yeah, I know. That's why I was curious if you had any clever ideas. :)

-chuck

-- 
"But she goes not abroad in search of monsters to destroy." - John 
Quincy Adams


More information about the dev mailing list