Ah, the wicked mistress that is JavaScript. It has been years since I really got into JS; sure, I've made my share inline popup dialogs, AJAXified pages here and there, but nothing really in-depth since the bad ol' days of IE 5.5 and the DOM nightmares that would wake me in a cold sweat. I really didn't miss that aspect of JavaScript; certainly no moreso than a POW misses the war.
Well, it's a new world nowadays (old-timer talk): The DOM is almost universal and JavaScript has grown up... way up. Actually, JS hasn't grown up so much as the platforms (mostly) comply with the ECMA ratification from all those years ago.
Don't get me wrong -- back in the day I loved JavaScript as much as I loved my first new car. It was like Java and C++ without all the hassle, and you could make the web do tricks at a time when it was 99% static (god, do I miss those days). BUT, the aforementioned pain of cross-browser support meant hours and hours and hours of testing, tweaking, implementing tiny code "shims" to get stuff to work right ... it almost wasn't worth it in the end. The original menuing system at Pergo.com (dynamic JavaScript with HTML drop-downs loaded by Vignette that was 6-language friendly) took me weeks to get working properly. In the days before JSON, it was quite the technological feat to have all of those disparate points of navigation play nicely as a huge multi-dimensional array. It worked something like this:
pergo_menu[0] = new Object();
pergo_menu[0].text = "Interior Design"
pergo_menu[0].url = "../b/b1_interiordesign.html"
pergo_menu[0].items = new Array();
pergo_menu[0].items[0] = new Object();
pergo_menu[0].items[0].text = "Inspiration"
pergo_menu[0].items[0].url = "../b/b2_inspiregallery.html"
pergo_menu[0].items[1] = new Object();
pergo_menu[0].items[1].text = "Q&A designer"
pergo_menu[0].items[1].url = "../b/b7_talktodesigner.html"
That was all the backend guys had to do to update the nav. Not bad, even by today's standards.
So last week I was back "home" in New Hampshire for a long weekend of R&R and some great quality time with my three younger brothers. One friend of my brothers, Lokesh Dhakar, had long had web dreams, and I'd heard through the grapevine (brother #2) that he'd gotten a job offer from Google.
Me: "Hold the phone... Google? Lokesh? Google?"
Brother: "Yeah, he invented some kinda new popup thing that everyone in the world wants."
Me: "Uh, okay." (brother is not web-savvy)
In the night of formal brotherly carousing, friends from near and far gathered at a local tavern, including Lokesh.
Me: "Hey, Lokesh, what's up?" (we've always been friendly, although I used to be the cool web guy... now the shoe's on the other foot)
Lokesh: "Hey, Matt! Good to see you."
Me: "What's this about you inventing popups?"
Lokesh: "Well, that's not really it. I made this thing that pops up on pages and makes it really easy for anyone to implement. I got calls from Yahoo, Google, Microsoft, and a bunch of others. That's how I got my current job."
Me: "Uhh, popups?"
Lokesh: "Well, it just made them easy. Check out my website and Lightbox and you'll see."
To me, Easy Popups != Google job. There had to be something more.
Indeed there was.
Lightbox leverages the prototype library, script.aculo.us, and a whole lotta DOMmin'. The result is a really, really, mindlessly easy way to add a pretty "see larger image" link on a web page.
About two hours later, I was incorporating the concept into our web service's dev system. I've long done "pop-in" dialogs with IFRAMEs and a PNG shadow, but the effect of a pseudo-modal, smooth interactive element is a thousand times better.
So now I've been JavaScripting for two straight days, loving and hating it all over again. The remaining burning question:
WHY ISN'T THERE A REAL JAVASCRIPT EDITOR YET?
Seriously. The language is there, the platforms are there, but for the love of king and country I still can't debug it without silly elements named "tracediv" and a whole bunch of nodeValue calls.
Debugging in IE is still a joke, even with the developer toolbar (please stop overriding CTRL+R, thank you). That being said, I still haven't loaded the Venkman JavaScript Debugger... That's for tomorrow.