jQuery is not trying to stop you from detecting browsers, rendering
engines, and/or features any way you'd like in your own code. It's
just telling you to avoid the use of $.browser. jQuery core no longer
uses $.browser internally because it was not reliable and it's
impossible to test.

> The suggestion was that the jQuery documentation be
> reworded so that $.browser not be called 'Deprecated',
> but that its usage perhaps be discouraged.

Take a look at http://dev.jquery.com/ticket/2661 . What better way to
discourage its use than to have it return bad information? ;-) If
$.browser remains in jQuery, people expect it to be "correct" for
their definition of correct. Perhaps another round of patches in 1.4
can make it work well enough that there won't be tons of additional
bugs reported against it, but I kind of doubt it. If it can't be fixed
then I think it *should* be removed.

You could argue that $.browser should use feature detection to guess
browsers instead of userAgent, but that just opens a different can of
worms. Consider http://dev.jquery.com/ticket/5391 . If Chrome and
Safari essentially use the same core engine, should they be treated as
a single browser or as different browsers? To answer that, you need to
know if $.browser users are trying to detect the browser brand name,
the browser rendering engine, or infer particular browser capabilities
based on their own experimental observations.

These dilemmas go away if you use feature detection or conditional
comments instead of $.browser, because *you* know what you were really
trying to get at. Or, craft your own detection based on the presence a
feature you think is a good proxy for the feature you can't detect
directly.

> For instance I'm developing a webpage and I happen to know
> that IE7 doesn't support the 'before' or 'after' pseudo selectors...

It seems like it could be feature-detected with a small load-time test
case with an element and some CSS to determine whether those pseudo
selectors work. Or, just use conditional comments in your code if it's
really IE-specific.





--

You received this message because you are subscribed to the Google Groups 
"jQuery Development" group.
To post to this group, send email to jquery-...@googlegroups.com.
To unsubscribe from this group, send email to 
jquery-dev+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/jquery-dev?hl=en.


Reply via email to