Design Diary: Interesting JavaScript Bugs Born from My Bright Ideas

There are two (known today) very subtle bugs coming from my latest bright ideas about professional JavaScript. Actually there’s one bug today the other is a design ‘issue.’ The bug is characterized by a click event that fires and fires—like it’s in a loop. I wasted many hours (at ‘home’ and in the W2 labor camp) trying to look for loops. No dice.

It turns out (J’ah provides) that my Display Builder pattern did not account for running display builder procedures once at load time instead of again and again. I’m not going to take the time (this month) to find the exact proof of this but it appears that ‘wiring up’ events repeatedly with YUI can cause them to fire repeatedly.

The second issue (bug?) has to do with Firebug. You see, my interpretation of Douglas Crockford’s module pattern (published in JavaScript: The Good Parts which slightly different from the YUI pattern) means my code is full of this stuff:

(function(){

    SONGHAY.ui.Client =
    {
        //use ‘self’ instead of ‘this’ in here…
    };

    var self = SONGHAY.ui.Client;

})();
                  

Buy this Book at Amazon.com! According to Doug’s jslint.com, the variable self is not of a closure. This is because it appears after the object literal, SONGHAY.ui.Client. In fact, the variable self is marked “unused” by jslint.com (but, when the variable self appears inside of SONGHAY.ui.Client, it is not marked as an implied global—until further notice, this little detail is very important to me).

When debugging this stuff in Firebug, the variable self is assigned to “Window”—which I assume is a bug or me writing crappy JavaScript. I am not afraid to be told that I am writing crappy code—so any person reading this (with some documentation to back them up) please do take the time to inform me instead of snickering to yourself like a punk-ass Church mouse and moving on… I assure you: you will not be wasting your time… You see how deprecating I am when asking for help?

The question “we” might ask here is, “Why are you trying to avoid using the keyword this?” Here are a few links that cover the this issue:

A Pile of Web Links

JSLint and Firebug

I thought it would be easy to find a Blog post from some popular dude that gets 100s of comments per post about why Douglas Crockford’s JSLint and Joe Hewitt’s Firebug are not integrated somehow… I’m sure something will come up.

“Catching up with Silverlight 2”

Most of the MIX 08 videos from Microsoft are listed and categorized in “Catching up with Silverlight 2.” Lists like these are actually more convenient than the crufty dog-food Silverlight interface developed by Microsoft. Like Adobe with tv.adobe.com, the Microsoft Silverlight designs still make islands isolated from the benefits of a simple HTML page. Yes, Microsoft has spent billions on “backwards compatibility” but the official Yahoo! design principles of “graceful degradation and progressive enhancement” are lost on these kids, imposing their green-field dreams on real people maintaining real “legacy” bases.

“Adobe to Port AIR to Linux”

On Slashdot.org: “Adobe To Port AIR To Linux.” Adobe follows with “Adobe Labs—Adobe Flex Builder Linux Public Alpha.” But the real mover and shaker will be a Flex/AIR “killer app”—so something like Photoshop Express or “New AIR-powered Adobe kuler desktop” will make real change.

the sixtyone beta

Another new music discovery site… I still haven’t gone through the dream machine rituals at GarageBand.com yet…

Motion Picture Visualization Guilt Trips

Since I am supposed to know “everything,” I’m supposed to know why I saved links for topics like H.264.