Sure,

The following returns true in IE 6.

'TSubdivision.js'.endsWith('_controller.html')

I am using the latest 1.5.1_rc2 prototype downloaded from

http://www.prototypejs.org/download


As I mentioned before, the problem exists whenever the string's length
is one less than the pattern's length.


this.lastIndexOf(pattern) == (this.length - pattern.length);

The pattern isn't matched, so the left side is -1, but the right side
is also negative one.

Thanks for your help, let me know if I'm missing anything.

Justin

p.s. here is a small html file to test from:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://
www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml";>
<head>
<title>Scaffold</title>
<script language="javascript" src='prototype.js' type="text/
javascript"></script>
<script language="javascript" type="text/javascript">
    alert('TSubdivision.j'.endsWith('_controller.htm') )
</script>
</head>
<body>
</body>
</html>



On Apr 23, 10:36 am, tobie <[EMAIL PROTECTED]> wrote:
> Hi Justin,
>
> Can you please provide a relevant test case where endsWith doesn't
> work.
>
> Thanks,
>
> Tobie
>
> On Apr 23, 10:59 am, Jupiter ITS <[EMAIL PROTECTED]> wrote:
>
>
>
> > Tobie,
> >   I issued a patch.  As you suggested, I got the latest RC2 but the
> > problem still exists.  Also, I've seen many other posts in this forum
> > about issues/bugs, is this not the place for them?  Thanks for you
> > help,
>
> > Justin
>
> > On Apr 21, 6:25 pm, tobie <[EMAIL PROTECTED]> wrote:
>
> > > Please post your paches with relevant tests in trac.
>
> > > If you're unsure how to do that, checkhttp://prototypejs.org/contribute
>
> > > Regards,
>
> > > Tobie
>
> > > On Apr 21, 6:34 pm, Jupiter ITS <[EMAIL PROTECTED]> wrote:
>
> > > > prototype 1.5.1_rc2 endsWith is broken when the string length is one
> > > > less than pattern length.  Fix with the following:
>
> > > > endsWith: function(pattern) {
> > > >     var index = this.lastIndexOf(pattern)
> > > >     if(index == -1)
> > > >         return false
> > > >     return index == (this.length - pattern.length);
> > > >   }- Hide quoted text -
>
> > > - Show quoted text -- Hide quoted text -
>
> - Show quoted text -


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" 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/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to