[thelist] javascript default event handlers, default events. [TIP]

Kowalkowski, Lee (ASPIRE) lee.kowalkowski at hmrcaspire.com
Wed Aug 31 12:00:16 CDT 2005


> -----Original Message-----
> From: Matt Warden [mailto:mwarden at gmail.com]
> Sent: Wednesday, August 31, 2005 4:37 PM
>
> This is directly analogous to how we separate style.

I dunno.  We use CSS to separate presentation from structure & content.  We
can do this pretty consistently as you have shown.

This has nothing to do with separating presentation from behaviour.

I propose that:

	<elem id="foobar" onFoo="bar()">

Is the correct way to separate presentation and behaviour, because this is
just an interface, the behaviour is not here, where is the behaviour?


Where as:

	document.getElementById("foobar").onFoo = bar;

Has not separated behaviour and presentation at all, in fact they're more
coupled now.  I'm explicitly referencing a presentation element, not that I
think that it can be totally avoided, but we can do this:

	<elem onFoo="bar(this)">

Now at least we don't need to explicitly reference "elem", because we are
passed a reference to it as an argument.


Do you see how this is more loosely coupled from a behaviour / presentation
standpoint?

- LK


===========================================================
Our e-mail domain has now changed from iraspire.com to hmrcaspire.com. Please update your address books.
===========================================================



More information about the thelist mailing list