D
David Mark
[...]Garrett said:On 5/24/2010 6:57 PM, David Mark wrote:
Garrett Smith wrote:
On 5/24/2010 2:11 PM, David Mark wrote:
Garrett Smith wrote:
On 5/22/2010 1:25 PM, David Mark wrote:
Ry Nohryb wrote:
On 22/05/10 16:22, Johannes Baagoe wrote:
Dmitry A. Soshnikov :
[...]
But jQuery might be selecting that element, depending on the browser,
its version, the rendering mode, and other css rules. The article says
that jQuery finds the elements whose "width is 600px".They have no idea what they are doing. That's not news. But I checked
their latest and they don't even call their own "attr" function in the
query portion, so the height/width thing I was referring to does not
apply. Apparently you meant that their docs were wrong. That's not
news either.
Apparently I was referring to an article that the jQuery team tweeted
about. I've stated that several times now. Get with the picture.
That's why you should use my patented avoidance technique.
That one's obviously no good. If you'd tested it you would probably have
realized that.
Don't be silly. It's quite good and I did test it. No surprises at
all. That doesn't mean it is perfect for every context, but I covered
a couple of common use cases, as well as some rare ones. IIRC, I ran
it through the usual gamut of IE5-8 (quirks and standards modes),
Opera 6-10, FF1-3.6, etc., getting the width/height and then setting
it to make sure it didn't warp the elements. If you managed to
stumble on to something I missed, I would be quite surprised.
It's a simplified version of the same basic logic I've been using for
years. Beats the hell out of relying (solely) on computed styles.
Usually I do some testing to determine if computed styles can be
trusted and fall back to setting, measuring offset*, adjusting and
reseting. I've tried to explain these concepts to you many times, but
you always start reading aloud from the specs.
Where are the unit tests?
That's all you ever say. Where is your understanding of the basic
logic. IIRC, that one was posted to refute your assertion that
computed styles should be used to determine positions. At the time,
you seemed to be the only one who didn't get it.
So, if that element is matched in the author's selector query
"img[width=600]" the query would not be doing what he says it does.
Namely, it would not match "all the images whose width is 600px".Yes, it's all nonsense. Don't rely on these silly query engines (or
their documentation).
Pass on that.
Whether you pass or not, it is quite a demonstration of the futility
of the query-based libraries.
I think you are a bit confused about how jQuery's Sizzle thing works.
[...]
Are you bluffing?
No.
What jQuery does for attribute selectors is inconsistent with the CSS
2.1-based Selectors API (draft).
I know. I've pointed that out repeatedly over the years. And it
wasn't too long ago that you tried to dismiss such talk as "anti-
jQuery propaganda". So what now, you are on the bandwagon? Great.
jQuery results are inconsistent and
depend on the element, its applied style values, the browser, its
version, the rendering mode, whether or not attributes are quoted,
whether or not the "context" param is present.
Yes, we've been over this ad nauseam. Much of it is illustrated by my
test page (the one you "passed" on).
jQuery wraps QSA in try catch that will often, depending on the code,
result in the catch block being entered. At that point the hand-rolled
query engine is used.
No kidding. They should never have dropped QSA on top of their old
nonsense. The two are obviously wildly different. Also demonstrated
on my test page.
Throwing errors is a performance hit, and one
which I would certainly want to avoid, however considering the other
inefficiencies in jQuery, I could see how this could seem insignificant
to the author(s).
It's the least of their problems.
The author of that article stated that the attribute selectors provide a
"very accurate" way to "select the elements knowing their attributes and
values".
Yes, he's obviously clueless.
The examples he provided have a comment that contradicts what he says it
does in the article; that: "img[width=600]" matches "all the images
whose width is 600px".
Yes, that was a stupid thing to say.
That selector will do that in certain cases and in certain browsers, but
not consistently across the browsers that are supported. What the
comment says sure doesn't match anything close to native Selector API
(and the query itself is invalid anyway).
Yes, we already went over all of this (in this very thread).
Sizzle matches nodes based on the DOM that the browser builds. The DOM
varies, especially in various versions IE. Trying to accommodate for
those shortcomings is, as I stated earlier, not outweighed by the
complexity entailed by that.
It's a fool's errand. That much is clear (and has been clear for some
time).
Results depending on the selector text used, quotes on attribute values,
the presence of a `context` arg (second param for jQuery(selector,
context)), can have a result that seems paradoxical, like a
"Shroedinger's Cat" result.
All old news (even for this post). I've posted a link to the
discussion about the QSA context divergence several times. The funny
thing is that the library authors knew they were screwing, but went
ahead and dumped QSA on top of their old crap anyway.
[...]
Are you being silly? I've always said the (completely optional) query
portion was basically a parody and should not be used. And the
comparisons between mine and the products of the "many eyes" projects
are quite illuminating. As was well documented last winter, it didn't
take more than a few weekends to accomplish what they have failed to do
in five years. You better believe it is superior (in virtually every
way possible). So if you must, you best use mine.
YOu wanna know what's silly? Designing an API "to make a mockery of
jQuery".
Why is that silly?
Worse yet, providing an interface with methods "E" and "Q" and
whatever the other one-letter method names are, along with other badly
named abstractions that provide value, such as gEBI or getEBI, etc. Just
use the real method: document.getElementById.
For one, "E" and "Q" are no worse than "$" and "Y". And they aren't
method names at all, but optional constructors for the OO interface,
which sits atop the API. E is for Element, Q is for Query. What is
"$" for?
And the getEBI function does provide added value (as was discussed
back in 2007 when it was first published here). Where have you been?
All this, while claiming to be superior. Where are those unit tests you
keep mentioning, BTW?
At least some of them are right under your nose (if you cared to
look). You should subscribe to My Library GG so you can keep up on
the progress of the project.
Nothing to say? Oh, that's right; you "passed" on those.
[...]
By the way, CSS2.1 states that attribute selectors take a string
(quoted) or identifier, as in img[width="600"], and not img[width=600],
but provided examples showing unquoted values as strings.
That's the least of their worries.
I think you are a bit confused about how jQuery's Sizzle thing works.
LOL.
Now that QSA is here, using a two-level QSA with a side of mish-mash
library is beyond ludicrous. Of course QSA behaves very differently
than the handmade query engines, which are demonstrably incomplete and
You don't say? So was there something to attribute selectors being
unquoted after all?
You seem to be going around in circles.
Using QSA might make sense in the near future, depending on how widely
it is implemented. It is incompatible with the libraries today.
No kidding.
As to what "they" are thinking, you can either guess or assume. You
could, for example ask:
| What is the rationale for using Sizzle as a fallback when QSA is
| unsupported? Are you aware that the two are incompatible?
I don't care to ask them. Their rationale for bizarre design
decisions is not my concern.
You could start a new thread on that and even post a link from jQuery
forums (or tweet or blog, etc). Keep in mind that if you call names and
insults, it becomes a lot easier to dismiss your criticism as biased hate..
It's been done to death. Again, where have you been?