[Javascript] standards scripting
Paul Novitski
paul at novitskisoftware.com
Thu Jan 6 14:58:30 CST 2005
At 06:54 AM 1/6/05, Shawn Milo wrote [in OT: I'm back!]:
>Whatsa matter, everyone quit using JS? Are you
>all podcasting now, instead? ;o)
Welcome back, Shawn. I've also been giving this list a rest the last
several months while polishing my CSS & XHTML. I've found that a lot of
the presentational manipulations I used to get with Javascript I can now
get from CSS, although sometimes I still use a touch of JS to get things
rolling. For example, instead of using js to make blocks appear &
disappear, I use js (or a server-side script) to toggle the class name of
the body element (or another parent container), and then use CSS selectors
to toggle display of the child elements. It reduces my scripts to wee
little things or eliminates them entirely. I'm still using javascript for
input validation and other functions, but am moving as much of my
presentational manipulations into stylesheets as I can.
I now use Mozilla Firefox as my base browser and bring up IE only to do
page checks, the opposite of how I was working a year ago. I'm very aware
that IE is used by a strong majority of users, but my first priority is now
to make pages that work with W3C standards, then I tweak after the fact to
accommodate Microsoft's clever but frustrating idiot-savant browser. This
means I have, for the time being, bade a sad farewell to Microsoft's DHTML
extensions of javascript because it feels like a waste of my time to write
script that the Mozilla-class browsers can't utilize.
Although I don't use it yet in my own applications, I find Dean Edwards'
IE7 project very interesting -- a javascript module that persuades Internet
Explorer to obey CSS2 standards, including applying the :hover pseudo-class
to all elements, not just anchors. http://dean.edwards.name/IE7/
Having spent an intense year in 'standards' listserves such as CSS-D and
WSG, I'm revising my ideas of when & where javascript use is
appropriate. I still value scripting and expect to remain in this list,
but my scripts have been shrinking even as my stylesheets have been expanding.
I've also become much stronger at separating content (HTML) from
presentation (CSS) from behavior (JavaScript), and no longer use inline
styles or scripting. These days my XHTML pages contain at most <script
src= tags in the header, but no longer any script inline including <body
onload=.
In this new regime of mine, I try not to use javascript on public websites
for any function that's critical to one's comprehension or use of the page,
because I want my pages to work well in user agents that don't have
scripting enabled. For example, fancy footwork on hover will not mean much
in a screen reader or another agent that has no mouse. Therefore I tend to
use js now only for extra niceties, which is a much smaller domain than my
full-on use of scripting a year ago when my attitude was much less
accommodating to folks who can't or don't wish to use scripting. In this
list I'll be mostly interested in applications of javascript that enhance
pages that work, rather than those that make pages work.
Warm regards,
Paul
More information about the Javascript
mailing list