W3C home > Mailing lists > Public > www-svg@w3.org > June 2006

Re: [SVGMobile12] content of the handler attribute of listener

From: Dean Jackson <dino@w3.org>
Date: Fri, 9 Jun 2006 07:28:22 +1000
Message-Id: <B1367EF3-6A55-46CF-91C9-F2C5D1FC6AA5@w3.org>
Cc: www-svg@w3.org
To: Jean-Claude Dufourd <jean-claude.dufourd@streamezzo.com>

[resending with correct subject - apologies for the bad formatting]

 > > > Neither the SVGT12 spec nor the XML events spec writes
anything about
  > > > what element type can be pointed to by the handler attribute
of the
  > > > listener element, nor about any behaviour resulting from this
pointing.
  >
  > > > We believe the list of allowed element types and the respective
  > > > behaviours should be specified in SVGT12.
  >
  > > What is the list of "allowed element types" though? Since the
only thing
  > > that is needed is a handleEvent() method, and there is nor
reason that such
  > > a method could not be applied dynamically (for example, via
XBL), then there
  > > is very little that can be enforced.
  >
  > We are more interested in what makes sense than in what can be
enforced in
  > this case.
  > To make things clear, I understand listener can have this syntax:
  >
  > <ev:listener ... handler="#foo"... />
  >
  > We wonder:
  > - is there a restriction on the elements which can have the id
foo ? for
  >   example, can foo only point to a handler element or a script
element ?

foo can point to any element, although it may not always make sense.
As Mark said, all the referenced element needs is a way to handle
the Event, and that might be added by script dynamically.

  > - if so, is it an error or is it just ignored if #foo points to an
  >   unauthorized element ?

There never is an error. In the case where foo is not
an EventListener, then it is ignored.

  > - what is the behaviour for an authorized element ?

The markup is equivalent to DOM calls. So

<ev:listener event="click" target="#b1" handler="#m1"/>

is equivalent to

b1.addEventListener('click', m1, false)

If m1 is a <handler> element, then the code of the handler
is executed (with the appropriate event). If it isn't, then
it's implementation should be an EventListener, in which
case you call m1.handleEvent().

Dean
Received on Thursday, 8 June 2006 21:28:30 GMT

This archive was generated by hypermail 2.3.1 : Friday, 8 March 2013 15:54:34 GMT