[whatwg] On separation of code and data

Anne van Kesteren annevk at opera.com
Thu Jun 7 07:35:58 PDT 2007

On Thu, 07 Jun 2007 16:00:59 +0200, Jerason Banes <jbanes at gmail.com> wrote:
> You may know this already, but the on* handlers have been deprecated and
> replaced with the DOM 2 Events* standard. So instead of doing 'onclick =
> "DoFunction()"' the programmer should be calling
> "element.addEventListener('click',
> DoFunction, false)". If I understand you correctly, this effectively
> achieves your "no code in data" request. At least as far as the standards
> go.

Hmm. I'm not quite convinced that using addEventListener is always better.  
It's much more convenient to have event listeners in the markup. It also  
makes sense if it's just a part of the application.

Anne van Kesteren

More information about the whatwg mailing list