No, I haven't added a method like that. I'm should do something though.
I was thinking of adding a defaultAction property to the custom event.
This property would be a callback function that gets called once the
event bubbling is complete.
What do you think of this idea?
BTW, if you ask this question then you are probably using JSB quite a
lot. I've made a few changes to it that you may be interested in. Let me
know if you want to test-drive the latest code. I'm thinking that it is
about time I checked in my latest work anyway. :)
-dean
Mmm. Let me think about it. There is no analogous call in the DOM API.
I'm still inclined to think that an event has a default action that can
be prevented. The action should be tied to the event somehow. It's not
for event listeners to decide what the default action should be. It is
for the event dispatcher to decide.
>> BTW, if you ask this question then you are probably using JSB quite a
>> lot. I've made a few changes to it that you may be interested in. Let me
>> know if you want to test-drive the latest code. I'm thinking that it is
>> about time I checked in my latest work anyway. :)
>
> I will, I'll send you a personal message with an example of some of my
> latest work with it.
>
> I'll definitely want to testdrive:-)
OK. I'll warn you that base2 version 2.0 is a little bit different to
version 1.0. You probably won't notice a lot of the changes. The main
change is the way that Packages are created.
In the base2 core, I've removed the JavaScript package and the Map class
(Collection does everything that Map does). I'm also renaming Module to
Trait (not final), to avoid people confusing it with the module pattern.
I'm also providing base2.exec, base2.require and base2.ready which can
be used to execute base2 code.
base2.DOM is renamed to base2.dom but other than that is largely the same.
base2.JSB is renamed to base2.jsb. All base2 packages names are now
lowercase. The JSB API has changed slightly:
addClass --> classList.add
removeClass --> classList.remove
hasClass --> classList.contains
toggleClass --> classList.toggle
setStyle --> style.set
getStyle --> style.get
I've also added a behavior method called "fire" which is optimised for
dispatching custom events. It is also a lot less verbose than
dispatchEvent (which is still supported).
I'll also be supporting two new packages: base2.io and base2.jst
(templating). There will also be base2.XMLHttpRequest which is compliant
with the Selectors API 2 spec and fixes lots of cross-browser bugs.
So, there are quite a lot of differences but they are mostly
boiler-plate. Like I said the APIs are mostly the same but with
improvements in speed and accuracy (for DOM APIs).
> By the way, have you considered moving to github?
I've thought about it. I like a lot of things about googlecode, it's
reliability and issue tracking particularly. I've already moved from
SourceForge to googlecode. I'm not sure I can be bothered to move again.
-dean