W3C home > Mailing lists > Public > www-svg@w3.org > March 2004

SVG1.2 EventFilter impl.

From: Jan-Klaas Kollhof <keyjaque@yahoo.com>
Date: Mon, 22 Mar 2004 08:32:49 -0800 (PST)
Message-ID: <20040322163249.18020.qmail@web60110.mail.yahoo.com>
To: www-svg@w3.org

Hello,

Last week I commented on the EventFilter suggested in
the SVG1.2 draft.

I suggested to use match objects (tuples with propName
and propValue) and AND and OR objects to create
filters, or even better have filter statements instead
of having only the set of properties SVG1.2 uses.

What I did is I tried the statement approach and impl.
it in JavaScript.
The filter statements look like the where clause in an
SQL statement:
"evt.clientX > 100 AND evt.clientX < 150" to filter
all events where the clientX is between 100 and 150.
It works quite well and is quite flexible.
Here is an example:
http://jan.kollhof.net/projects/svg/playground/evtfilter.svg

The EventFilter class is defined in a jsolait module:
http://jan.kollhof.net/jsolait/ext/dom/eventfilter.js


One question I have with the EventFilter:
If I register a Listener with the filter is the
evtType taken into account or is it ignored ? 
In ohter words isn't the evtType already a filter
criteria?

For example:
I register a listener which would like to lisent to
all mouse events
where clientX > 100.
Do I have to do:
filter.setFilter("evt.clientX > 100")
filter.addEventListener("mousemove", el, false)
filter.addEventListener("mouseup", el, false)
filter.addEventListener("mousdown", el, false)
myElement.addEventListener("mousemove", filter, false)
myElement.addEventListener("mouseup", filter, false)
myElement.addEventListener("mousedown", filter, false)

or s it enough to do something like this:
filter.setFilter("evt.clientX > 100")
filter.addEventListener(ALLEVENTS, el, false)
myElement.addEventListener("mousemove", filter, false)
myElement.addEventListener("mouseup", filter, false)
myElement.addEventListener("mousedown", filter, false)

I know there is no ALLEVENTS. 
What I am trying to say is can/should there be that
shortcut to save some typing and put all filtering
into the statement?



Jan



__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html
Received on Monday, 22 March 2004 11:42:36 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 5 November 2012 23:52:55 GMT