D
David Mark
RobG said:I think the basis of David's argument is that they are a bad idea
because of the differences in implementations.
That's been the result, but not the cause of the problem. The problem
is that it layers a literal ton of complexity on top of something that
should be very simple (e.g. DOM traversal). The result has been spotty
and buggy implementations that have diverged as the browsers have
converged, thereby taking up the slack in the incompatibility
department. And then there are the related issues of code size and
speed, particularly the latter which has resulted in lots of rapid-fire
updates designed to make tests run faster. It's the stupidest, most
pointless "arms race" in the history of programming and we will be
dealing with the fallout indefinitely now that QSA is becoming standard
equipment.
Because various
libraries introduce an additional set of inconsistencies, the range of
possible outcomes is greatly increased.
Yes, and then these bums dumped QSA on top of it, despite _knowing_ that
it would cause myriad more inconsistencies.
http://ejohn.org/blog/thoughts-on-queryselectorall/
It was done in the name of speed, yet there would be no bottleneck if
not for the ill-advised query-based designs. What sort of
"programmers" would universally adopt something they know is
incompatible with their previous efforts? That idiot who botched the
Dojo query engine (and he's an idiot for lots of reasons, not just that)
said something about it being a "specs bug". Look, a spec is a spec.
Never mind if it invalidates your life's work. In this guys case, his
legacy is Dojo, so he's not exactly going to go down in history as a
luminary anyway.
I think simple CSS queries can be very helpful, but most of those can
be easily replaced with simple ad hoc functions.
The simpler they get, the more likely you can do away with the CSS
selector parsing without any noticeable decrease in convenience
(assuming you find querying by CSS selectors convenient in the first
place). As a rule, performance and simplicity will increase.
Complex selectors can
be harmful, not only for performance, but they more tightly bind
programming logic to document layout so that a small change may cause
a script to fail or enhancements to become unreliable.
Yes, that's another good point. People go nuts with these things and
expect them to "just work", but the sad truth is that even the "major"
libraries fail on very simple queries in the latest major browsers (and
get worse as you go back in time until they eventually provide nothing
but wrong answers). You can't do progressive enhancement like that as
the calling applications will be hard-pressed to spot wrong answers.
I also suspect that complex selectors are more likely to have
inconsistent results, but don't have any proof.
Well, they have been demonstrated to fail (seemingly at random) in even
the simplest of cases. Doesn't it follow that moving up a degree in
complexity will increase the frequency of inconsistent results?
As for David's hyperbole, I took it as just that. Scale it back to
half-throttle and you get "[CSS] queries can lead to problems", which
is true.
There's a lot more to it than that. These things have pretty much
ruined browser scripting. At a time when it should be trivially simple
to write cross-browser applications, it is instead virtually impossible
if you buy into query-based crap like jQuery, YUI, Dojo, etc. And
unfortunately, lots of Web developers (who don't know JS, browser
scripting or the history behind any of it) have bought into it, ensuring
that most browser-based applications will continue to be laughable.
It wasn't that long ago that it was standard practice to
ensure sites worked without scripting and that script only enhanced
usability.
Ah, there have always been cranks that said otherwise, but it has
certainly gotten worse of late. It's like they don't realize that
search engines can't see their dynamic content either. They see it as
progressive, whereas anyone who has been around has graduated from that
phase (myself in the late 90's) and realized that you _must_ start with
a static HTML page, which is 100% usable and accessible, and build up
from there. Granted, some people like to point out video games and
other non-sites, but the answer is to dynamically generate links to
those pages. Obviously you don't want to index a video game, but you do
want to index the page(s) that lead to it.
Lately there has been a trend to sites that are
dysfunctional without scripting.
Yes, a disgusting trend promoted by people thoroughly ignorant of their
medium.
I expect that within a few years,
browsers that do not have efficient built-in query selector support
will find the web quite unfriendly. That will lead to problems for
less capable browsers and platforms.
If the imbeciles have their way, nothing will work without both
scripting and query support. It's madness. It's also doomed to fail as
technology will replace it with something else and the Web will be
relegated to hobbyists and scientists once again.
Incidentally, I tried surfing with Safari 1.0.3 recently - very few
sites were functional, including apple.com.
That's not surprising. Their own sites don't work on the iPhone and
IIRC, they are a supporter of the SproutCore library. (!)
Considering it's younger
than IE 6 (2004 vs. 2001),
I thought IE6 came out just prior to the end of last century, but I
could be remembering wrong. (?)
it is clear that if IE 6 didn't have the
market share it has, developers would have stopped coding around its
quirks many years ago and it would be dead by now. Imagine a web where
most browsers were DOM and CSS 3 compliant and HTML5 was mostly
implemented, then javascript libraries could focus on efficient
delivery of high-level functionality, not smoothing over browser
quirks.
The thing is that the libraries never could figure out IE6 (or why they
should stop trying to bottle conditional comments). It's not that the
reality is that unclear, but it's been clouded by massive delusions.
And this thread would be irrelevant.
And there would definitely be no need for GP JS libraries at all.