2008/6/6 T.J. Crowder <[EMAIL PROTECTED]>:
>
> Yeah, Richard's approach would be about eight times more elegant...if
> there were something reliable to test for.  It can be IE-specific, of
> course.  I was sure when I saw his post that there would be
> *something* we could check for, but none of the things that come to
> mind are both present (IE doesn't have arity) and sufficiently unique
> (see Kangax's comments about call, apply, etc.).  (BTW, don't try to
> iterate the properties of an intrinsic function object using for..in
> with IE6 on XP; Bad Things happen.)
>
> Sadly my big list approach just won't work, it will always have holes
> in it.  For example:
>
>    var x = document.createElement("p");
>    if (Object.isFunction(x.getAttribute)) { ... }
>
> So between the holes and the bloat involved in handling even the ones
> we could handle, I'd say we just mention it in Object.isFunction's
> docs and move on, until/unless someone finds the magic thing.
> --
> T.J. Crowder
> tj / crowder software / com
>
> On Jun 6, 12:51 pm, kangax <[EMAIL PROTECTED]> wrote:
>> I wish it was that easy : ) Unfortunately, we can't really account for
>> all host objects, which are notorious for their incompliance with
>> specs (e.g. it's well known how some of them have no constructor
>> property, and others throw error when accessing certain properties).
>> Hardcoding few methods barely solves the problem.
>> We could of course check for "apply/call" members on an object, but
>> guess what - those are undefined as well : )
>> As far as I remember jQuery calls object's toString, then tests if
>> result contains "function". That's clever, but unreliable, as any
>> other object which defines "toString" to return something that
>> contains "function" will produce falsy results.
>>
>> - kangax
>>
>> On Jun 6, 6:08 am, "T.J. Crowder" <[EMAIL PROTECTED]> wrote:
>>
>> > OMG, I can confirm this, on IE6 anyway.  (Couldn't they get *anything*
>> > right?  I mean, I know Firefox has its issues, but...  And yes,
>> > technically a function is an object, but that's no excuse.)
>>
>> > The only workaround that immediately comes to mind is to actually have
>> > a list of these and compare against them in IE -- e.g.:
>>
>> > isFunction: (function(){
>> >     if (typeof window.close == "object") {
>> >         // IE version, works around typeof returning "object" for
>> > intrinsic functions
>> >         return function(object) {
>> >             return (
>> >                 typeof object == "function"
>> >                 || object === window.close
>> >                 || object === document.getElementById
>> >                 // etc., etc., etc.
>> >             );
>> >         };
>> >     } else {
>> >         // Non-IE version, expects typeof to work correctly
>> >         return function(object) {
>> >             return typeof object == "function";
>> >         };
>> >     }
>>
>> > })()
>>
>> > Blech.  The more of this that happens, the more I want a separate file
>> > that only IE people have to download containing these workarounds...
>> > --
>> > T.J. Crowder
>> > tj / crowder software / com
>>
>> > On Jun 6, 9:27 am, Viktor Kojouharov <[EMAIL PROTECTED]> wrote:
>>
>> > > Here's quite the problem in IE.
>>
>> > > For certain 'native' functions, like window.close, or
>> > > document.getElementById, typeof for those functions returns on object
>> > > in IE. Consequently, Object.isFunction will actually return false for
>> > > those functions.
>>
>> > > Though there's probably little that can be done, I thought you guys
>> > > should know about it.
> >
>

What about a process of reduction? Those that can be id'd successfully
by having a particular property then that solves them. The remaining
ones ...

And as much it pains me ... is it about time we had a
browser_version_compatibility_plugin.js ?

That way, for those that need to support clients with ie6, then they
load the ie6 compatible layer. sort of thing. Hmm. There are a LOT of
browsers and versions aren't there?

-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
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 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to