Fun with DOM
Started: Friday, February 2, 2001 00:34
Finished: Friday, February 2, 2001 01:15
Alrighty then. Yes, I'm up late. But I had a nice long nap. Very soon after getting home from work, I collapsed on the bed in exhaustion.
4.5 hours later: It's 22:30, and Bitscape arises. Spurred along by an inspiring article I read today, and by the thoughts of a fellow content farmer, I decided it was time to get with the program. See if I could make this stuff do what I wanted it to do.
I began writing scripts. JavaScript. A function here, a function there, Mozilla as my constant companion. Here's what I eventually ended up with.
Dat browser is so freakin cool. It did everything I tried (admittedly not a hugely exhaustive test, but still...) and it worked as expected. A consistent set rules which behave like you'd think they would! Could it be that ugly hacks in JavaScript might actually become a thing of the past? One can hope...
After I had what I thought was a satisfying demo for the evening, I decided it would be a good idea to test it out on another browser. Hmmm... Went to the Opera page and grabbed the latest available demo version. Debian packages to download. That's always a plus.
I ended up getting the static version; for some reason, the one dynamically linked against qt didn't like me. No biggie.
Anxiously, I opened my html file, and was sadly disappointed when it didn't even show my dynamically generated form buttons. Doh! And here I thought this browser was supposed to have DOM support. Somethin fishy here...
I went back to the Opera page, and looked a little closer. First of all, the latest news stated that Opera 5 was out, but I distinctly recalled version I had gotten as being a 4.0 beta version. Looked closer. Opera 5 is Windows only!?? Ick. Strike one.
Looked a little closer, and discovered it probably wouldn't have mattered even if I did have Opera 5. When you read the fine print, it becomes evident that in its current incarnation, Opera's DOM support is actually rather anemic.
"Modifying the document structure is not yet possible (ie. you cannot add or remove HTML elements)."
Duh! My experiment relied on dynamically building each of the form's elements and sticking them into the document's structure. So apparently, with Opera, you can modify existing elements, but doing true dynamic stuff is still a no-no. Ho hum. (Not that my particular form strictly needed to be dynamacally generated to do what it does, but the whole idea was for me to learn how to do it.)
Oh well. If my little test works (or doesn't work) in your favorite browser, I'd be interested to hear about it. I am idly curious as to whether it works in IE, which theoretically has some DOM support, but I'm certainly not going to pollute poor Argo with Windows in order to find out.
I think I'll go back to bed now. (And yes, you could say that my little test might have implications relating to a certain Content Collective feature, but I won't be putting it in anytime soon. ;)