Good point and agreed. :)

The more I think of it, the less I actually need to use browser detection, because Prototype does all the things for me, so we can safely store away this in the Prototype object. It isn't really used that much, even not in extensions libraries, but a Prototype.Browser.XXX is much nicer on the eyes as the navigator regexp stuff.

One thing that came to mind is extending the navigator object itself, but this is *probably* not possible consistently crossbrowser-wise (also "navigator" feels so 1995...). ;)


Am 19.01.2007 um 23:28 schrieb Andrew Dupont:

I took a cue from Sam's "Prototype.BrowserFeatures" object.

I am not against adding to the namespaces, but I want to make sure it's
done judiciously and carefully.  Note that typng
"Prototype.Browser.KHTML" is still easier than typing
"navigator.userAgent.test(/KHTML/)".  And while I don't think that
browser detection is something we should shy away from lest we
encourage bad coding practice... well, I don't think we should be
giving it first-class treatment either.  Putting it inside the
"Prototype" object sends the message that it's for Prototype's internal
use and isn't *necessarily* meant for public consumption.


On Jan 19, 4:31 am, Thomas Fuchs <[EMAIL PROTECTED]> wrote:

I like the overall implementation, but find writing "Prototype.Browser.KHTML" a bit verbose.
Personally, in some scripts i've used something like:

if (Engine.isKHTML) ...

The patch even has a var B = Prototype.Browser; line.

Thoughts on this? It's more like a general issue if we like to have more namespaces or stick to what we have.

In general it might also be worthy to investigate some more $something shortcuts, maybe not for the browser detection, but based on some analysis of existing code you guys use (that is, often-called methods that could use a shortcut).


You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [EMAIL PROTECTED]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at

Reply via email to