Hi,

You're probably running into equality vs. identity (loose equality vs.
strict equality).  The emerging standard for what Array#indexOf is
supposed to do uses strict equality (===), not ==, whereas previously
Prototype used loose equality.  This is an issue with strings because

    "mpg" !== new String("mpg")

even though

    "mpg" == new String("mpg")

Oddly, I can't replicate the behavior you're seeing on IE8 if I have
Prototype loaded, but I can easily do so without it by calling
isVideoFile(new String("mpg")).

HTH,
--
T.J. Crowder
tj / crowder software / com
www.crowdersoftware.com

On Sep 1, 11:14 pm, Mojito <[email protected]> wrote:
> My function works as expected in all non-IE browsers.  But when I try
> it in IE8, it doesn't scan the array correctly.  Any easy workaround
> rather than implementing my own indexOf()?
>
> +++++++++++++++++++++++++++++++++++++
>
> function isVideoFile(extension)
> {
>     extension = extension.strip();
>     alert(typeof extension);
>     alert(extension);
>     alert(['3g2', '3gp', 'asf', 'asx', 'avi', 'flv', 'mkv', 'mov',
>             'mp4', 'mpg', 'mpeg', 'qt', 'rm', 'vob', 'wmv'].indexOf
> (extension));
>
> }
>
> +++++++++++++++++++++++++++++++++++++
>
> The output when I pass in 'mpg':
>
> 1) string
> 2) mpg
> 3) -1
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype & script.aculo.us" 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-scriptaculous?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to