Hi Felix,I just had a look at the implementation of ScriptableItemMap and the implementation is quite elegant, performance-wise, there are only two minor issues:
- it does not expose the Iterator interface- returned items are not casted into scriptablenode and scriptableproperty if possible.
these two things are quite easy to fix which would allow using the API in a spec-conformant way and in a way that can be used with Javascript for loops, etc.
regards, Lars On 14.03.2008, at 08:31, Felix Meschberger wrote:
Hi all, This issue and SLING-329 give raise to an interesting question: The ScriptableNode implements the ECMA getNodes() method returning an EMCA object containing all properties. This is fundamentally different from the spec which says an Iterator is returned.In fact, it completely breaks my knowledge of JCR in that I would not be able to iterate as I would expect it: while (iter.hasNext()) { Node n =iter.next(); } In addition, this might also be a performance hog because theconstructor of the respective object iterates the complete JCR iterator to build the object (this is probably required for the implementation).So what are the opinions out there on this break in API ? Regards FelixAm Donnerstag, den 13.03.2008, 09:40 -0700 schrieb Michael Marth (JIRA):access to node props in esp --------------------------- Key: SLING-328 URL: https://issues.apache.org/jira/browse/SLING-328 Project: Sling Issue Type: Bug Reporter: Michael Marth My .esp looks like for (var i in currentNode.getNodes()) {if(currentNode.getNodes() [i].getProperty("approved").getString() == "true") {... Bertrand tells me that in the second line this should work as well: if(currentNode.getNodes()[i].approved (...) It does not give an exception but the property is undefined.
-- Lars Trieloff [EMAIL PROTECTED] http://weblogs.goshaky.com/weblogs/lars
smime.p7s
Description: S/MIME cryptographic signature