Archive for JavaScript

YSlow? Dunno!

But now there’s no excuse!  Download YSlow for Firebug to get a ton of additional detailed information about performance issues in your Web pages.

You need Firebug, for Firefox, but it’s well worth it to make the chance if you aren’t already using a real browser.

Comments

Internet Explorer doesn’t know it’s own objects.

I just ran across a post by David Flanagan, wherein he mentions that Internet Explorer on a Windows machine, XP in this case, doesn’t agree with its own understanding of global objects, namely the Window object.

The code he illustrates that does not behave as expected is:


window.onload = function()
{
    alert(window.event == window.event);
}

For some strange reason, Internet Explorer believes this comparison is false.  To fix this behavior, or rather, *tell* Internet Explorer how it should behave I propose resolution.  You can achieve resolution in one of two ways.


var we = window.event;
alert(we == we); // true in IE

*OR*


window.onload = function()
{
    alert(!!window.event == !!window.event);
}

It should be mentioned, that the double NOT’s first create a Boolean conversion, returning the opposite (logical NOT), then reverses what was returned.  I forgot exactly who coined this particular use, but it was first made apparent to me by a very talented gentleman by the name of “RobG” in the comp.lang.javascript newsgroup.

This process is however called normalization, well, not in a database-sense, but anyway… see “A double use of the ! operator…

*OR*


window.onload = function()
{
    alert(Boolean(window.event) == Boolean(window.event));
}

“Um, but you said 2 methods, toe.”  Right, I know.  But the last method is doing the same as the second method, only much cleaner and technically faster.

Granted, as Mr. Flanagan explains, “This probably does not have any impact on real-world code.”  But nonetheless quirky, well, rather downright stupid oddities in one of the most mainstream browsers (sadly) is an oddity that all JavaScript developers should be aware of.

Comments (1)

Help me win some Ajax books!

Yep, you can help me win a few books from Justin M. Schultz’s site http://www.funwithjustin.com/.

So do me a favor and click here for Ajax Tutorials. It really is that simple.  By following that link you are helping me to notify Justin’s statistics script that you were referred by me.

Despite the link name, there are no tricks, no hidden spam, and no adult material.  It is a simple contest to win a few Ajax developer books.  That’s all.  It was his wish that all links have either that name above, or Blogging Tutorials, or even Internet Marketing.  So hell, click on any of them if you like, they all do the same thing!

Make sure you check out his Blogging 101 and Copywrighting 101 areas.  Definitely a ton of useful content there.

Thanks!

Comments

TagClouds in Pure JavaScript.

I recently had the bright idea to create a nice tag cloud application in pure JavaScript and power it via an XML file, and/or a backend (such as an RDBMS).

Then someone pointed me to Kang-min Liu’s Widget.TagCloud implementation.

Dammit.

Well, Kang-min’s version does not pull cloud information from an XML file or a database.  Instead it uses “array of hash.”  Basically an array containing JSON data or Object declarations.

I may modify his application to include both of these.  In one route I can use DOM methods to load an XML file for parsing, on the other, to keep it purely JavaScript, as in, no HTML document containing a form, I would have to use an XMLHttpRequest to coordinate data from the database.

We’ll see…

Comments

SlickSpeed - JavaScript Framework CSS Selector Test Suite

MooTools released this nifty application that runs 6 mainstream JavaScript libraries through a rigorous CSS selectors test.

It definitely bummed me out to see jQuery come in *5th* place, but hey.

Check it out, SlickSpeed.

Comments

Safari, for Windows.

Say what!?  Yep, you heard right.  Apple has released Safari for the Microsoft Windows platform.

http://www.apple.com/safari/download/

This of course has sent some people into a tizzy.  Then again, others, like myself, see this as a prime opportunity to add another standards-compliant browser to our cache of development tools.

In fact, I *love* that Apple has released this version.  Now I do not have to rely on BrowserShots to see what my pages look like in Safari.

Of course there will always be some JavaScript zealots who feel the need to complain.

As I’ve said though, this makes life much easier for a JavaScript developer.

Comments

« Previous entries