Hey Jacob,

On 8-Jul-09, at 9:47 AM, Jacob Farber wrote:

Hi Everyone,
Im having some trouble with a new Webkit event called “webkitTransitionEnd” (triggered by using CSS Transitions)

To add the event to an element, this syntax works:
fluid.unwrap(element).addEventListener("webkitTransitionEnd", options.callback, false);

However, to remove the listener this syntax isn’t running:
fluid.unwrap(element).removeEventListener("webkitTransitionEnd", options.callback, true);

That third argument (the boolean) specifies whether capturing should be used for this event handler. The argument has to be the same for both the call to addEventListener() and removeEventListener(). False is fine for both; I think I had sent you on a wild goose chase on that one.

Here's the documentation for removeEventListener(), just for reference:

https://developer.mozilla.org/En/DOM/Element.removeEventListener

The callback is queueing up and firing multiple times, since the callback is only being added over and over and never removed. I’ve tried using a slew of methods to rewrite these events, rebind them in different ways, etc. The removeEventListener method hasn’t worked so far.

Do you see any obvious mistakes – syntax or otherwise?

Your code in fluid.transition() appears to work just fine, but I'd suggest writing a unit test just to prove it to yourself.

The issue is how you're using fluid.transition() in the rest of your code. So if you take a look at your defaultTransitions() function, you'll notice that you create a new instance of your callback function each time defaultTransitions() is invoked. As a result, your code in fluid.transition() has no reference to the old callback function, and so it can't remove it. That's why you're getting event listeners piling up on top of each other. In order to successfully remove an event listener, you've got to have a reference to the actual instance.

For those of you following along on the list, Jacob and I talked through this a bit on the IRC channel this morning. Here's a transcript:

http://wiki.fluidproject.org/display/fluid/fluid-work+IRC+Logs-2009-07-08

Colin

---
Colin Clark
Technical Lead, Fluid Project
Adaptive Technology Resource Centre, University of Toronto
http://fluidproject.org

_______________________________________________________
fluid-work mailing list - [email protected]
To unsubscribe, change settings or access archives,
see http://fluidproject.org/mailman/listinfo/fluid-work

Reply via email to