During a bit of development downtime here, I've been working on making XBLinJS work on any ol' DOM nodes, not just HTML ones. Which, most notably today, means that you can in theory use XBLinJS as a drop-in replacement for the actual, factual XBL. It also means it can be used with other document structures that use DOM and the same basic event structure, like perhaps SVG someday. If we're extra good developers, we may someday see widgets that successfully integrate both XUL and SVG at the same time. Maybe even cross-browser...? Please?
Mostly it involves turning some document.createElement calls into document.createElementNS calls, and a little (very little!) bit of bookkeeping to decide which to use. (createElementNS is DOM2, which not all browsers support, so I can't require it, but you can't use DOM reasonably in a modern XML document without it.)
Which means, hooray!, another set of quirks to deal with. Because if you think that XUL might be implemented as a kind of super-HTML, almost identically implemented but with extra widgets, boy would you ever be wrong! Functionally, it's much more like an extra wimpy HTML, only with extra widgets that are extra likely to crash the browser or randomly and untracably fail. The theoretical power is greater, and you can certainly realize much of it, but what ought to be unmitigated benefits (especially as you can embed arbitrary XHTML in XUL) is severely weakened by its spotty implementation.
I had some real trouble with the getting the events to register correctly, but fortunately, while XUL doesn't like node.onclick for a node that isn't yet on the screen (more "it has to be rendered for it to be real" crapola that I remember from my XBL days), you can use addEventListener.
If these target-specific hacks start piling up, I'll factor them out into a support "Flavor" object so they don't clutter up the code and you can just load the one you want, but so far they are limited and can't add more than a couple hundred bytes to the compressed code. We'll see if they stay that way. (I'm currently guessing 50/50 there will be something like this in 0.4.)
The XUL-support stuff is in CVS, but poorly tested. (My plan is to get to the point where a person who cares about XUL can do something real, but not necessarily perfectly, which is a pre-requisite for anyone to care.) The extra JS console, not for the moment.
Features are always in flux until such time as the release occurs, but here is the current plan for 0.4:
- Event handling at the moment is questionable. I had to get wacky to work with IE 6, and I'm not yet convinced things will work across frames like they are supposed to, or that widgets can attach to other widget's events like they are supposed to. Simple cases work. That will be better tested in 0.4.
- Finally, I intend to have some sort of tutorial up, which will also serve as a better explanation of what XBLinJS is if you don't already know what XBL is. I haven't worried too much about that up to this point because the library wasn't necessarily ready for that bunch of people, but I think it is getting there.
No promises on any front, but that is the plan. I have no idea when this release will be because while I am using XBLinJS a lot in almost all of my current projects, a public release is a lot of work with no immediate and obvious benefit to either me or the project at the moment, and I have no idea when I'm going to be able to spare that time over the next few months. I'm getting dangerously close to living in those "interesting times" of the famed (if apocryphal) Chinese curse.
XBLinJS version 0.3 is released; get it at SourceForge.
For people who don't really care about XBLinJS per se, but do care about web development issues, you may wish to check out my dangerously-close-to-rant statements about my experiences with Mozilla's technologies. (The only things saving them from being a rant is that I propose that XBLinJS, or at least something like it, is a solution to the issues I raise; I tend to think of rants as things with little or no constructive value.) This is why an XBLinJS release announcement is posted also on my blog's front page.
(I've already found a new bug in the .3 release; inherited className values can't be retrieved correctly with .get(). However, since AFAIK 0 people are using this library, I'm not going to make a new release for that one. Use the CVS if it ever becomes a problem for you.)
JSON is pretty
(most likely in a browser) is involved it may not be a bad
choice. It's even a great choice if you're firing structured data
I've released XBLinJS 0.2, which includes some example widgets and much better documentation.
|<- Future Posts|