Personal tools
You are here: Home   Notes   Plan to make events rebindable  
Search
 
Document Actions

Plan to make events rebindable

by Balazs Ree last modified 2006-12-30 11:03

this is to study the possibility of implementing this in kss in the future

So, at the moment this kind of rebinding is not done. The only thing that is done is binding to newly inserted nodes.

Now that we talk about it if we want these features we have to deal with some challenges..

Unbinding of existing events

I don't know of any way to unbind, say, a click event on the browser level. Which means if we want to allow this, we need a different requirement against the binding api: our conceptual events need to be able to unbind any time. This must change the implementation of the browser events too. Which is actually feasible, I am sure Mochikit supports it for example, but then we must change the browser event layer to that, first. (We wanted that anyway at one point, so ok.

Locate bound rules to be invalidated after a change

This is the bigger problem, as I tried to express you earlier. Suppose you change the class of the body tag? This, potentially may invalidate all the bound events in the entire tree. So currently I don't find any smarter way then to unbind all events in the subtree of the changing node, and bind all of them again. This means going through _all_ the kss rules, for the subtree. This could become a very costy operation. Although when we improve cssQuery for our purposes, and the tree is not big, this may turn out to be acceptable.

How to trigger the rebinding

Because of selecting, not only class but also attribute changes may require a rebind. This probably means that the rebinding must be invoked explixitely.