This is a request for comments as described at http://
wiki.openlaszlo.org/Enhancement_Proposals.  If this proposal is
accepted after community discussion, the task to implement it will be
assigned in JIRA.  Acceptance doesn't imply a commitment to schedule it
against any specific milestone; community interest and the
availability of contributors will help to determine this.

Please comment!

A task to implement it is already entered in JIRA as issue LPP-850 -
http://www.openlaszlo.org/jira/browse/LPP-850

PROPOSAL
========
LzDatapointer should expose getPosition() to determine position of node's data
in array of data.

Right now this is available via
  comp.datapath.xpathQuery("position()")

proposed change is adding
  comp.datapath.getPosition()

which is a wrapper around
  comp.datapath.__LZgetPosition()


I ran across this while optimizing a moderately-sized application for Laszlo
Studios. The xpath query isn't getting called enough in my app to make a large
difference, but every available ms helps and I'd rather not use undocumented
(hence unsupported) calls.

CODE
====
LzDatapath already defines a private __LZgetPosition function.  This proposal
is to add this as a public method on the datapath.  The fix would be the
following one-line change -
          LzDatapath.prototype.getPosition() =
              LzDatapath.__LZgetPosition;

NOTES
====
1. While starting to write this up as an RFC I thought that a better approach
may be to implement a indexOf() method on the Array object and let developers
get to a position argument by using something like -
    comp.datapath.p.parentNode.indexOf(comp.datapath.p)
or both could be implemented.

This is already part of the Core JavaScript 1.5 project at Mozilla.  There is
no corresponding ECMAScript proposal.
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to