Andrea said:
sorry Michael
I don't remember when I wrote that code, and it has always worked fine
for what I had to do by that time, sniffing included, a common
technique in 2004 or before.
It was (and is) a common incompetent technique that was discarded by
professional (and conscientious) developers around the turn of the
century. At some point (hopefully very early) on the learning curve,
aspiring browser script authors realize the futility of relying on a
string of characters that is designed to deceive (e.g. browser
developers and end-users use it to deceive incompetent browser sniffing
scripts). Unfortunately, in 2010, we have this rogue's gallery of
"major" JS projects still making inferences based on this arbitrary (and
often deceitful) string:
- Dojo
- Prototype
- YUI
- Closure
- Cappuccino
- SproutCore
....and countless minors like the execrable "pragmatic" Base2 and many
non-entity throwaway scripts as well. The jQuery project has since
moved up one rung in the latter to object inferences, which are still
based on pigeonholing _today's_ observations.
http://www.jibbering.com/faq/faq_notes/not_browser_detect.html#bdOI
Of course, it took years of beating them over the head with some very
basic truths to move that mountain and I never did get a thank you note
from Resig.
So what is going on here? Are all of these people so stupid that they
can't understand the cited article? No. They are simply relatively new
to cross-browser scripting, which is a discipline that takes a long time
to master and is unlike virtually any other field of programming. Of
course, as programmers, they are arrogant, so they don't want to hear
that explanation.
The pitch for most of these projects is that browsers are wildly
different, which is not really true these days, but was indeed the case
when most of these people first started with browser scripting.
The other thing they are selling is that browsers change rapidly so you
need a team of "experts" to help you keep up. Again, this couldn't be
more false for most contexts these days. It is particularly false for
projects that need only concern themselves with major desktop browsers
(or at the extreme, a subset of their versions). Of course, most sites
on the Web don't have this luxury, but that hasn't stopped misguided Web
developers from deploying scripts that behave as if they do (e.g.
unreliable in anything but the very latest versions of a handful of
major desktop browsers in their default configurations). Somehow, some
way, this practice has come to be known as "saving time", despite the
fact that it virtually guarantees the exact opposite.
How has this happened? The developers of the scripts never learned
cross-browser scripting (or are talking their time about it anyway), so
they rely on outdated and misguided techniques like browser sniffing,
which necessarily results in scripts pinned to _today's_ observations
(what they refer to as "current" browsers). So they write lots of
branches based on what they _observe_ (typically failing to understand
the abstractions in play) and produce scripts that, at least
superficially, seem to work today. Okay, but getting back to their
pitch, if browsers change so fast and in so many different directions,
how can it be useful to write logic based on _today's_ observations?
That's where the whole movement vanishes in a puff of logic (or will
vanish in the future anyway). If you really need people to watch
browsers and write code (more like diaries) based on those observations
to keep up with browsers, then it stands to reason that the same people
will have to rewrite the same code indefinitely (and at an ever
increasing frequency as the number of browsers in use increases). So,
to anyone who can grasp basic logic, it should be clear that their
time-saving pitch is completely flawed. They are basically selling a
lifetime installment plan of rewrites, re-testing, re-deployment,
support headaches (support plans are often part of the scam), etc.
That's it.
Now, as code is not written, debugged and tested instantaneously, it
stands to reason that there will be gaps in synchronizing the
observations, resulting code and (what must be compulsory) browser
upgrades. These gaps will become wider as more browsers are introduced.
Many of these projects have attempted to rationalize their illogical
plans by claiming not to "care" about anything but the very latest
browsers, but unfortunately, the end-users aren't going to care what the
script authors care about. When your site starts having problems, they
will get upset, perhaps calling for support from (or summary execution
of) the owners, but more likely moving on to greener pastures. Often
the argument is made that it doesn't make sense to take any action until
complaints start rolling in, but that doesn't fly as most end-users
don't feel it is their duty to complain (and Web developers have earned
a justified reputation as less than amenable to criticism).
And then there are the pseudo-intellectuals who will focus on the _past_
and say that if that's how it has been done for all of these years, it
must be right (see Matt Kruse) and any voices to the contrary must be
mad, idealistic, naive, whatever. It's all bullshit.
Ah, but I digress...
so why bother ? just for fun ?
Why bother with what?
As I have said, all your answers are zero outcome.
As I have said, all your base are belong to us.
I am sure you have
lot of time to spend here,
If you knew Time as well as I do...
have fun then, please try to be more useful
for the community as well, don't keep the fun all for you. Cheers
Uh, cheers (I think).
P.S. which blog? which book? if you are superficial and you don't know
things, again, why bother? do you feel better after?
Since you ask, I feel a bit sick at the moment. You are dizzying.