Quirks we can forget

| 1 Comment

I've just realized that there is one annoying JavaScript special-case that web developers no longer need to know about, and I don't need to document anymore.

As you know, JavaScript event handlers return false to cancel the browser's default action for the event. Except, that is, for the onmouseover event handler. Because of a bug in Netscape 2.0 (I think) we've always had to return true for that one. Documenting this special case has become a habit for me.

How nice, therefore, to realize that this is now irrelevant. The only default action associated with a mouseover event is to display the destination URL of a link. But to prevent phishing attacks, browsers no longer allow us to cancel this default action (and no longer allow any kind of status line scripting). Since the action can't be cancelled, the return value of onmouseover no longer matters. Hooray!

So I can now just document "return false to cancel". (Of course I still have to document e.preventDefault() for event handlers registered with addEventListener() and e.returnValue=false for event handlers registered with attachEvent(), but this is a step in the right direction.)

1 Comment

Hello David,

I deeply appreciate having your JavaScript book by the side while scripting. It is phenomenal! I really enjoy the way you explain the language. It is the only book I replaced with a new print.

I'd like to tell you how I solved an obscure bug yesterday. It appeared that a recent version of the Explorer browser had difficulty appending Stylesheet link elements to the head element - after append-remove-append of a scripted Stylesheet the block styles were discarded while the inline styles worked.

This was solved by instant append-remove of a dummy Stylesheet link, ha!

Thanks again, I am really enjoying it!
You should know.
Gerard

Leave a comment

Books

Comprehensive coverage of Ruby 1.8 and 1.9

"The New Most Important Ruby Book"
Peter Cooper,
rubyinside.com

Completely updated for Ajax and Web 2.0

"A must-have reference"
Brendan Eich,
creator of JavaScript

The classic Java quick-reference

Advertising

Pages

Hosted By

Powered by Movable Type 4.21-en