You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tapestry.apache.org by "Charles Capon (JIRA)" <ji...@apache.org> on 2014/08/07 19:48:13 UTC

[jira] [Commented] (TAP5-2370) [JavaScript][utils] startsWith method unexpected behavior.

    [ https://issues.apache.org/jira/browse/TAP5-2370?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14089518#comment-14089518 ] 

Charles Capon commented on TAP5-2370:
-------------------------------------

I don't know where to find a field to attach a patch but it doesn't really matter, the fix is very simple.

> [JavaScript][utils] startsWith method unexpected behavior.
> ----------------------------------------------------------
>
>                 Key: TAP5-2370
>                 URL: https://issues.apache.org/jira/browse/TAP5-2370
>             Project: Tapestry 5
>          Issue Type: Bug
>          Components: tapestry-core
>    Affects Versions: 5.4
>            Reporter: Charles Capon
>            Priority: Minor
>              Labels: javascript, utils
>
> I found that the _startsWith_ method that can be found in the _utils_ module has unexpected behavior. It works well for most cases except when your pattern is repeated on or more times in your string :
> * string: foobar - pattern: foo -> true
> * string: foobarfoo - pattern: foo -> false
> It's because _string.lastIndexOf_ is use instead of _indexOf_.



--
This message was sent by Atlassian JIRA
(v6.2#6252)