HotKeys jQuery Plug-In version 0.7 is out

Last night I released a new comprehenced version of jshotkeys. This plugin lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.
For example, to bind Ctrl+C to a function fn simply type:

$(document).bind('keydown', 'Ctrl+c', fn);

See the live demo.


Too Bad To Be True (or Dear Ray Ozzie: IE8 can’t handle Windows Live)

Yesterday, while walking from launch, my freind Amnon David (the creator of jNext) told me that IE8 doesn’t work on hotmail.com.

Since IE8 release gained lots of credit by JavaScript Hackers (John Resig and many more), therefore, I couldn’t believe it until I saw it in my own eyes.

Plain and simple, the site is broken. Icons, texts, menus are overlapping each other.

Everyone can see now that every piece of DHTML code must be written twice, once for all the browsers, and then specifically for IE.

The unbearable lightness of releasing buggy software at MS is shocking.

The results are deployed here in front of your eyes.

IE8 default mode Ie8

IE 8 emulating IE7

Emulated IE7

Firefox 3 Beta 3

firefox3-beta


New Version for JS HotKeys

I finally was able to fix a few minor bugs and compile a new version of my js-hotkeys module. Get your copy now (tar.gz || zip)

Js-Hotkeys is a jQuery plugin that lets you easily add and remove handlers for keyboard events anywhere in your code supporting almost any key combination.

Read more at:
http://code.google.com/p/js-hotkeys/wiki/about
Live demo at:
http://jshotkeys.googlepages.com/test-static.html


Getting things right vs. Getting things done

Most of today’s web developer will tell you that

the following:

<h2 id="foo">Click Here</h2>
<script>
    $('foo').click = function(){alert("Hello")};
</script>

is better than:

<h2 id="foo" onclick="alert('Hello');">Click Here</h2>

and the following:

<style>
body{
    background-color:#ffffff;
    color:#000000;
    margin-top:3}
a{color:#0000cc}
a:visited{color:#551a8b}
</style>
<body>....</body>

<script>
$(document).ready(function(){
    sf();
    if(document.images){
        new Image().src='/images/nav_logo3.png';
    });
</script>

is far better than:

<body bgcolor=#ffffff
text=#000000
link=#0000cc
vlink=#551a8b
alink=#ff0000
onload="sf();if(document.images){new Image().src='/images/nav_logo3.png'}"
topmargin=3 marginheight=3>....</body>

and last but not least: Using HTML tables for layout-ing is evil.

The point is that the code above is taken from Google, Facebook and Yahoo.
Yep! All the majors seems to be caring less on standards and more for their own interests.

None of them are valid HTML and Google.com uses a table to align the two buttons (Google Search and I’m felling Lucky) in the middle of the page.


All JavaScript Passengers, Attention Please

This is an example why should one follow the rule of using ‘===’ and avoid ‘==’

var a = [];

[!!a, a == false] == [true, true]

You get !!a == true and at the same time a == false, now you are confused, ain’t you?

Therefore never ever you should be using in your code ‘==’ operator.

[!!a, a === false] == [true, false]
– > Feels better now, ain’t it?

“Follow the rules” is sometime a rule one should follow