[Javascript] Modern usage
Paul Novitski
paul at juniperwebcraft.com
Wed Apr 19 10:44:45 CDT 2006
At 07:47 AM 4/19/2006, Bill Moseley wrote:
>I'm updating a site and I'm questioning some of the javascript. I'm
>quite new to javascript, but I'm wondering how much of this might be
>for very old browsers, and how much is still required today.
For details on JavaScript support across browsers I recommend
Peter-Paul Koch's http://www.quirksmode.org/
>The page also is using ypSlideoutMenu from 2001. Anyone familiar
>with this? Would you consider it acceptable javascript?
>
>http://cvs.sourceforge.net/viewcvs.py/ypslideoutmenus/ypSlideOutMenus/ypSlideOutMenus.js?rev=1.2&view=auto
>
>http://ypslideoutmenus.sourceforge.net/demo/index.html
I don't think it makes the grade:
- It requires a mouse and doesn't work from the keyboard.
- It uses inline scripting instead of unobtrusively applying
behaviors from an external script.
- It mis-uses markup attributes such as title.
- The menus are unstructured clusters of anchors inside divs instead
of unordered lists.
- There's no structural relationship in the markup between parent
menu items and their sub-menus.
- When JavaScript isn't running, the individual menu links still work
but the page styling is very broken.
- The only thing this script provides that isn't possible using CSS
alone is the sliding effect, which for me is too minor a benefit to
justify its downsides.
- On the positive side, the script does test for browser capabilities
and doesn't merely sniff HTTP-REFERER.
Mind you, three or four years ago I loved writing scripts like
this. Having had my consciousness raised in the areas of markup
semantics and accessibility I can look back fondly but I can't go back.
Regards,
Paul
More information about the Javascript
mailing list