Hi folks,

the discussion so far led to the conclusion to remove all those macros 
for css() and attr(), eg. color() or val(). css() and attr() are already 
quite flexible: Both allow you to get a single property, set a single 
property or set a set of properties. I wonder if it would help to extend 
them to allow getting of multiple properties at once. A possible 
implementation would accept an array of String and returns a key/value 
object, with the values of the array as the keys. Is this useful?

Another interesting point that needs some discussion:
The event system is improved by accepting:
 - an amount paramter (the number of times to execute an event handler, 
default is infinite) and additional data when binding events
 - an bubble paramter (to trigger handlers of parent elements) and 
additional data when triggering events programmatically
The big so far unsolved question: What should the API methods look like? 
How to pass the additional data to the event handler?

Currently I favor an interface that looks like this:
$().bind("type of event", eventHandler, {amount: 5, data: additionalStuff})
$().trigger("type of event", {bubble: true, data: moreStuff});
This avoids any type checking of arguments and provides a clear API: A 
little bit more to type, yet less confusion when you need only one of 
the optional paramters.

Possible interfaces for the event handlers:
$().bind("click", function(event, bindData, triggerData) { ... });
$().bind("click", function(event) {
    event.bind // contains bind data
    event.trigger // contains trigger data
});

Your opinions?

-- 
Jörn Zaefferer

http://bassistance.de


_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to