[
https://issues.apache.org/jira/browse/SLING-291?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13870358#comment-13870358
]
Felix Meschberger commented on SLING-291:
-----------------------------------------
It looks like multiple JavaScript interpreters (Rhino, Firefox, Chrome)
interpret bracket indices of strings as converting the strings into arrays
(object actually) and accessing the respective character at the given position.
>From that point of view, this works correctly and there is nothing we can and
>should do about it.
> Clarify and test access to multi-valued Properties from server-side javascript
> ------------------------------------------------------------------------------
>
> Key: SLING-291
> URL: https://issues.apache.org/jira/browse/SLING-291
> Project: Sling
> Issue Type: Improvement
> Components: Scripting
> Affects Versions: Scripting JavaScript 2.0.2
> Reporter: Bertrand Delacretaz
> Priority: Minor
>
> In SLING-282, Michael Marth writes:
> the property "to" is multivalued.
> in the script I do something like:
> <%= currentNode["to"][0] %>
> if the value of "to" has only one value I seem to get back this value as one
> string so [0] gives me the first character. if "to" has 2 values I get back a
> collection so [0] gives me the first element. this is consistent with what
> ["to"].length gives me.
> I am not 100% sure if this is a bug (might be my lack of understanding for
> javascript), if so a comment on how to determine the result length of a
> multi-valued property would be appreciated.
--
This message was sent by Atlassian JIRA
(v6.1.5#6160)